Plan 9 from Bell Labs’s /usr/web/sources/contrib/mason/rc/usbext2:

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/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

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.