#!/bin/rc
rfork e
opts=()
while(! ~ $#* 0 && ~ $1 -*){
switch($1){
case -f -l -lf -fl
opts=($opts $1)
case -*
echo usage: $0 '[-fl] [disk [mtpt [spec]]] ' >[1=2]
exit usage
}
shift
}
disk=/n/disk/0/data
mtpt=/n/usb
spec=sdU0
switch($#*){
case 0
;
case 1
disk=$1
case 2
disk=$1
mtpt=$2
case 3
disk=$1
mtpt=$2
spec=$3
case *
echo usage: $0 '[-fl] [disk [mtpt [spec]]]' >[1=2]
exit usage
}
if(! test -f /srv/usbext2.$user){
if(! test -e $disk)
usb/disk $opts || exit 'no disk'
if(! test -d /dev/$spec){
disk/partfs -d $spec $disk || exit partfs
disk/fdisk -p /dev/$spec/data >/dev/$spec/ctl || exit fdisk
}
ext2srv usbext2.$user || exit ext2srv
}
mount -c /srv/usbext2.$user $mtpt /dev/$spec/linux
|