123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/bin/rc
- # usbfat: [-fl] [disk [mtpt]] - mount a USB disk's MS FAT file system
- rfork e
- opts=()
- while (! ~ $#* 0 && ~ $1 -*) {
- switch ($1) {
- case -f -l -lf -fl
- opts=($opts $1)
- case -*
- echo usage: $0 '[-fl] [disk [mtpt]]' >[1=2]
- exit usage
- }
- shift
- }
- disk = /n/disk/0/data
- mtpt = /n/usb
- switch ($#*) {
- case 0
- ;
- case 1
- disk = $1
- case 2
- disk = $1
- mtpt = $2
- case *
- echo usage: $0 '[-fl] [disk [mtpt]]' >[1=2]
- exit usage
- }
- if (! test -e $disk)
- usb/disk $opts || exit 'no disk'
- if (! test -f /srv/usbfat.$user) {
- blk = `{disk/fdisk -p $disk | awk '/^part dos / {print $3}'}
- if (~ $#blk 0 || ! ~ $blk [0-9]*) {
- echo $0: warning: no fdisk dos partition found... >[1=2]
- dossrv -f $disk usbfat.$user || exit dossrv
- }
- if not
- dossrv -f $disk:$blk usbfat.$user || exit dossrv
- }
- mount -c /srv/usbfat.$user $mtpt
|