xref: /plan9-contrib/dist/replica/binary (revision ca7c775877ff6ae315cba3108cad66fc0172d277)
1#!/bin/rc
2
3if(~ $fscons '')
4	fscons=fscons
5if(~ $replica '')
6	replica=replica
7
8s=/n/dist/dist/replica
9serverroot=/n/dist
10serverlog=$s/plan9binary.log
11serverproto=$s/plan9binary.proto
12fn servermount {
13	9fs sources
14	bind /n/sources/plan9 /n/dist
15}
16fn serverupdate { status='' }
17
18if ( ! test -e /srv/boot && ! test -e /srv/kfs ) {
19	echo 'error: neither /srv/boot nor /srv/kfs present; make sure you are running on the file server'
20	exit '/srv/boot or /srv/kfs not present'
21}
22
23if (test -e /srv/$fscons) {
24	if ( ! test -w /srv/$fscons ) {
25		echo 'error: no write access to /srv/'^$fscons^', make sure you are the host owner'
26		exit 'no write access to /srv/fscons'
27	}
28
29	fn clientmount {
30		if(! test -e /srv/$replica){
31			echo 'srv -AWP '^$replica >>/srv/$fscons
32			sleep 5
33		}
34		mount -c /srv/$replica /n/boot
35	}
36	c=/n/boot/dist/replica
37	clientroot=/n/boot
38}
39if not {
40	fn clientmount { 9fs kfs }
41	c=/n/kfs/dist/replica
42	clientroot=/n/kfs
43}
44
45clientdb=$c/client/plan9binary.db
46clientexclude=(dist/replica/client)
47clientlog=$c/client/plan9binary.log
48clientproto=$c/plan9binary.proto
49
50applyopt=(-u -T$c/client/plan9binary.time)
51