93 lines · 1.6 KB · Text
RawDownload
#!/bin/rc -e rfork nepath=/bin fn fatal {	echo $*	exit $"*} fn usage {	echo 'usage: contrib/install [-f] [-r root] user/name' >[1=2]	exit  usage	} root='/'force=falsewhile (~ $1 -*) {	switch ($1) {	case -f		force=true	case -r		root=`{cleanname -d `{pwd} $2}		shift	case -*		usage	}	shift} if (! ~ $#* 1)	usage usr=`{echo $1 | awk -F'/' '{print $1}'}name=`{echo $1 | awk -F'/' '{print $2}'} repl=/n/sources/contrib/$usr/replica/$namecfg=/dist/replica/$name if (test -x $cfg && ~ $force false)	fatal $name is already installed if (! test -d /dist/replica -w) 	fatal cannot write in /dist/replica 9fs sources || fatal mount server failed if (! test -d $repl)	fatal no such replica $repl dep=`{cat $repl/dep >[2]/dev/null}miss=()for (i in $dep) {	r=`{echo $i | awk -F'/' '{print $2}'}	if (! test -x /dist/replica/$i)		miss=($miss $i)} if (! ~ $#miss 0) {	if (~ $force false)		fatal missing dependencies: $miss	if not		echo warning: missing dependencies: $miss} proto=`{grep $name\.proto $repl/db | awk '{print $1}'} x='$'cat > $cfg <<!#!/bin/rcs=/n/sources/contrib/$usr/replicaserverroot=/n/sources/contrib/$usr/rootserverlchg=$x^s/$name/chgserverlog=$x^s/$name/logserverproto=$x^serverroot/$protofn servermount { 9fs sources }fn serverupdate { status='' }fn clientmount { status='' }c=/dist/replicaclientroot=$rootclientdb=$x^c/client/$name.dbclientexclude=(dist/replica/client)clientlog=$x^c/client/$name.logclientchg=$x^c/client/$name/chgclientproto=$x^clientroot/$proto!chmod +x $cfg >/dist/replica/client/$name.db>/dist/replica/client/$name.log>/dist/replica/client/$name.chg exec replica/pull -v $cfg

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t