1
0

defs 843 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. tmp=()
  2. fn fatal {
  3. if(! ~ $#tmp 0)
  4. rm -f $tmp
  5. echo $* >[1=2]
  6. exit $"*
  7. }
  8. fn must {
  9. $* || fatal $"*^': '^$status
  10. }
  11. fn need {
  12. for(i)
  13. if(~ $$i UNCONFIGURED)
  14. fatal $name^' does not set $'^$i
  15. }
  16. opt=()
  17. while(! ~ $#* 0 && ~ $1 -*){
  18. if(~ $1 -s -c){ # take one argument
  19. opt=($opt $1)
  20. shift
  21. }
  22. opt=($opt $1)
  23. shift
  24. }
  25. if(~ $1 --)
  26. shift
  27. if(~ $#* 0)
  28. usage
  29. name=$1
  30. shift
  31. paths=($*)
  32. if(! ~ $name /* ./* ../*)
  33. name=$home/lib/replica/$name
  34. if(! test -x $name)
  35. fatal no such replica $name
  36. cfgopt=()
  37. applyopt=()
  38. fn servermount { status='' }
  39. fn clientmount { status='' }
  40. fn serverupdate { status='' }
  41. for (i in clientroot clientproto clientdb clientexclude serverroot serverlog serverproto)
  42. $i=UNCONFIGURED
  43. . $name
  44. if(! ~ $#serverexclude 0)
  45. serverexclude=-x^$serverexclude
  46. if(! ~ $#clientexclude 0)
  47. clientexclude=-x^$clientexclude