shithub: sirjofri_de

ref: 8743fed50d5bc583409031c1e2d016ec77b8e3a6
dir: /pub/files/9gridchan/griddy/

View raw version
#!/bin/rc

flagfmt='t:tls,p:pub,q:quiet'

if(! ifs=() eval `{aux/getflags $*}){
	aux/usage
	echo ' -t  prefer tls
 -p  mount pubregistry services
 -q  quiet. Don''t ask, just do.' >[1=2]
	exit usage
}

# remove old services
test -e /srv/gridregistry && {
	if(~ $quiet 1) ans=n
	if not{
		echo 'old grid connections found in /srv, remove? (y/n)'
		ans=`{read}
	}
	if(~ $ans y){
		echo 'removing old'
		rm /srv/gridchat
		rm /srv/gridplumber
		rm /srv/gridram
		rm /srv/gridregistry
		rm /srv/gridroot
		rm /srv/gridwiki
		rm /srv/griddisk
		rm /srv/pubregistry
	}
}

# mount grid services (from registry)
~ $tls 1 && {
	echo 'mount services (tls)'
	test -r /mnt/factotum/ctl || auth/factotum -n
	echo 'key proto=dp9ik user=glenda dom=grid !password=9gridchan' >/mnt/factotum/ctl
	srvtls tcp!registry.9gridchan.org!16675 gridregistry /mnt/registry
	awk '/tlssrv/{print "srvtls -c", $1, $3, $5}' /mnt/registry/index | rc
}
~ $tls 1 || {
	echo 'mount services (no tls)'
	srv tcp!registry.9gridchan.org!6675 gridregistry /mnt/registry
	awk '/exportfs/{print "srv -c", $1, $3, $5}' /mnt/registry/index | rc
}

# mount public grid services (from pubregistry)
~ $pub 1 && {
	echo 'mount public services (pubregistry)'
	test -r /n/pubregistry/index || { echo 'pubregistry not found' >[1=2] }
	test -r /n/pubregistry/index && {
		awk '/tlssrv/{print "srvtls -c", $1, $3, $5}' /n/pubregistry/index
		awk '/exportfs/{print "srv -c", $1, $3, $5}' /n/pubregistry/index
	} | rc
}