#!/bin/rc
fn getmtime {
ls -l $1 | awk '{print $7 $8 $9}'
}
url='http://plan9.bell-labs.com/plan9/download/plan9.iso.bz2'
echo -n 'Downloading current plan9.iso.bz2 ... '
cd $home/tmp
omtime=`{getmtime plan9.iso.bz2}
hget -o plan9.iso.bz2 $url
echo 'done'
nmtime=`{getmtime plan9.iso.bz2}
if (~ $nmtime $omtime) {
echo 'plan9.iso.bz2 is current.'
}
if not {
echo -n 'Extracting plan9.iso.bz2 ... '
cat plan9.iso.bz2 | bunzip2 > plan9.iso
echo 'done'
}
echo -n 'Mounting plan.iso ... '
test -e /srv/9660 || 9660srv
mount /srv/9660 /n/dist $home/tmp/plan9.iso;
echo 'done'
echo 'Starting replica.'
rfork e
flags=()
while(! ~ $#* 0 && ~ $1 -*){
if(~ $1 -c -s){
flags=($flags $1)
shift
}
flags=($flags $1)
shift
}
if(test -f /srv/kfs.cmd)
disk/kfscmd allow
replica/pull $flags /dist/replica/cd $*
if(test -f /srv/kfs.cmd)
disk/kfscmd disallow
|