#!/bin/rc
cmd=()
quotes=''
fn usage {
echo usage: u9fs-setup [-q] cmd args >[2=1]
exit 1
}
fn error {
echo error: $* >[2=1]
exit 1
}
while(! ~ $#* 0 && ~ $1 -*) {
switch($1) {
case --
shift
break
case -q
shift
quotes=''''$quotes
case *
usage
}
}
if(~ $#* 0){
usage
}
shcmd='echo setting up $HOME/bin/u9fs on `hostname`;
mkdir tmp 2>/dev/null;
cd tmp && tar -zxf - && cd u9fs && make >/dev/null || exit 1;
mkdir $HOME/bin 2>/dev/null;
cp u9fs $HOME/bin || exit 1;
rm -r $HOME/tmp/u9fs
ls -l $HOME/bin/u9fs;
exit 0'
@{cd /sys/src/cmd/unix && tar -c u9fs} | gzip | $* $quotes^$shcmd^$quotes || exit nomagictoday
echo
echo do not forget to update ssh9fs
|