2011-03-30 13:53:33 +00:00
|
|
|
#!/bin/rc
|
|
|
|
|
|
|
|
# desc: subdivide plan 9 disk partition
|
|
|
|
# prereq: partdisk
|
|
|
|
|
|
|
|
fn autotype {
|
2011-04-22 00:50:41 +00:00
|
|
|
switch($fstype){
|
|
|
|
case cwfs cwfs64 cwfs64x
|
2011-04-20 03:49:58 +00:00
|
|
|
echo -a 9fat -a nvram -a fscache -a fsworm -a other
|
2012-08-07 15:57:04 +00:00
|
|
|
case hjfs
|
|
|
|
echo -a 9fat -a nvram -a fs
|
2011-04-22 00:50:41 +00:00
|
|
|
}
|
2011-03-30 13:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch($1) {
|
|
|
|
case checkready
|
|
|
|
if(! test -f /dev/sd*/plan9*){
|
|
|
|
prepdisk=notdone
|
|
|
|
export prepdisk
|
|
|
|
}
|
|
|
|
|
|
|
|
case go
|
|
|
|
echo 'The following Plan 9 disk partitions were found.'
|
|
|
|
echo
|
|
|
|
disks=(/dev/sd*/plan9*)
|
|
|
|
for (i in $disks){
|
|
|
|
echo $i
|
|
|
|
echo q | disk/prep -r $i >[2]/dev/null
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
if(~ $#disks 1)
|
|
|
|
default=(-d $disks)
|
|
|
|
if not
|
|
|
|
default=()
|
|
|
|
prompt $default 'Plan 9 partition to subdivide' $disks
|
|
|
|
disk=$rd
|
|
|
|
|
|
|
|
echo 'This is disk/prep; use it to subdivide the Plan 9 partition.'
|
|
|
|
echo 'If it is not yet subdivided, a sensible layout will be suggested;'
|
|
|
|
echo 'you can probably just type ''w'' and then ''q''.'
|
|
|
|
echo
|
|
|
|
disk/prep `{autotype} $disk
|
|
|
|
disk/prep -p $disk >`{basename -d $disk}^/ctl >[2]/dev/null
|
|
|
|
|
|
|
|
case checkdone
|
|
|
|
if(! test -f /dev/sd*/9fat)
|
|
|
|
prepdisk=ready
|
2011-04-22 00:50:41 +00:00
|
|
|
if(! ~ $prepdisk ready)
|
2011-03-30 13:53:33 +00:00
|
|
|
prepdisk=done
|
|
|
|
export prepdisk
|
|
|
|
}
|