defs 782 B

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