12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/bin/rc
- # diskparts [/dev/sd?? ...] - set up any disk partitions
- rfork e
- if (! test -e /dev/sdctl)
- bind -b '#S' /dev
- if (~ $#* 0)
- *=`{ls -d /dev/sd* | uniq}
- bind -a /bin/disk /bin >[2]/dev/null # work with /boot too
- # set up any /dev/sd partitions.
- # note that really big disks (e.g., aoe devices) may have no mbr
- # partition table because the mbr partition table can't cope with large
- # block numbers, so we may have to examine the data file with prep if
- # there's no plan9 file. beware that `disk/prep -p data' on a disk with
- # no plan 9 partition table will delete all extant partitions.
- for(disk in /dev/sd?[0-9]) {
- if(test -f $disk/data && test -f $disk/ctl){
- disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
- if(test -f $disk/plan9){
- for(part in $disk/plan9*)
- disk/prep -p $part >$disk/ctl >[2]/dev/null
- }
- if not{
- part=$disk/data
- if(! disk/prep -p $part>[2=1] | grep -s '^no plan 9')
- disk/prep -p $part >$disk/ctl >[2]/dev/null
- parts=($disk/data)
- }
- }
- }
- sysname=`{cat /dev/sysname}
- # set up any fs(3) partitions
- if (! test -e /dev/fs/ctl && test -e '#k/fs')
- bind -b '#k' /dev
- if (~ $#sysname 1 && ! ~ $sysname '' &&
- test -r /cfg/$sysname/fsconfig && test -w /dev/fs/ctl)
- read -m /cfg/$sysname/fsconfig >/dev/fs/ctl
|