diff options
| author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 17:14:36 +0300 |
|---|---|---|
| committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 17:14:36 +0300 |
| commit | 2959e1ede0ebc6fdffd7b8660f43c2ce14c9696f (patch) | |
| tree | f6343b1ce11a8c87251dd27cf3d3e26b50693fa7 /rc/bin/replica/defs | |
| parent | e463eb40363ff4c68b1d903f4e0cdd0ac1c5977f (diff) | |
| download | plan9front-2959e1ede0ebc6fdffd7b8660f43c2ce14c9696f.tar.xz | |
Import sources from 2011-03-30 iso image - rc
Diffstat (limited to 'rc/bin/replica/defs')
| -rwxr-xr-x | rc/bin/replica/defs | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/rc/bin/replica/defs b/rc/bin/replica/defs new file mode 100755 index 000000000..45b36419f --- /dev/null +++ b/rc/bin/replica/defs @@ -0,0 +1,55 @@ +tmp=() + +fn fatal { + if(! ~ $#tmp 0) + rm -f $tmp + echo $* >[1=2] + exit $"* +} + +fn must { + $* || fatal $"*^': '^$status +} + +fn need { + for(i) + if(~ $$i UNCONFIGURED) + fatal $name^' does not set $'^$i +} + +opt=() +while(! ~ $#* 0 && ~ $1 -*){ + if(~ $1 -s -c){ # take one argument + opt=($opt $1) + shift + } + opt=($opt $1) + shift +} +if(~ $1 --) + shift +if(~ $#* 0) + usage +name=$1 +shift +paths=($*) + +if(! ~ $name /* ./* ../*) + name=$home/lib/replica/$name + +if(! test -x $name) + fatal no such replica $name + +cfgopt=() +applyopt=() +fn servermount { status='' } +fn clientmount { status='' } +fn serverupdate { status='' } +for (i in clientroot clientproto clientdb clientexclude serverroot serverlog serverproto) + $i=UNCONFIGURED +. $name + +if(! ~ $#serverexclude 0) + serverexclude=-x^$serverexclude +if(! ~ $#clientexclude 0) + clientexclude=-x^$clientexclude |
