]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/diskparts
updating cwfs and moving installer in /rc/bin
[plan9front.git] / rc / bin / diskparts
1 #!/bin/rc
2 # set up any disk partitions
3 rfork e
4 if (! test -e /dev/sdctl)
5         bind -b '#S' /dev
6
7 # set up any /dev/sd partitions.
8 # note that really big disks (e.g., aoe devices) may have no mbr
9 # partition table because the mbr partition table can't cope with large
10 # block numbers, so we may have to examine the data file with prep if
11 # there's no plan9 file.  beware that `disk/prep -p data' on a disk with
12 # no plan 9 partition table will delete all extant partitions.
13 for(disk in /dev/sd*) {
14         if(test -f $disk/data && test -f $disk/ctl)
15                 { disk/fdisk -p $disk/data |
16                         grep -v '^delpart ' >$disk/ctl } >[2]/dev/null
17         if(test -f $disk/plan9)
18                 parts=($disk/plan9*)
19         if not
20                 parts=($disk/data)
21         for(part in $parts)
22                 if(test -f $part)
23                          { disk/prep -p $part |
24                                 grep -v '^delpart ' >$disk/ctl } >[2]/dev/null
25 }
26
27 sysname=`{cat /dev/sysname}
28
29 # set up any fs(3) partitions
30 if (! test -e /dev/fs/ctl && test -e '#k/fs')
31         bind -b '#k' /dev
32 if (~ $#sysname 1 && ! ~ $sysname '' &&
33     test -r /cfg/$sysname/fsconfig && test -w /dev/fs/ctl)
34         read -m /cfg/$sysname/fsconfig >/dev/fs/ctl