blob: e4baa649410470c65ebaaf5956add321ca9ca28c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/bin/rc
rfork e
# 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.
fn setup {
if(test -f $1/data && test -f $1/ctl)
{@{disk/edisk -p $1/data
|| disk/fdisk -p $1/data} |
grep -v '^delpart ' >$1/ctl } >[2]/dev/null
if(test -f $1/plan9)
parts=($1/plan9*)
if not
parts=($1/data)
for(part in $parts)
if(test -f $part)
{ disk/prep -p $part |
grep -v '^delpart ' >$1/ctl } >[2]/dev/null
}
if(~ $#* 0){
# set up any disk partitions
if (! test -e /dev/sdctl)
bind -b '#S' /dev
for(disk in /dev/sd*) {
setup $disk
}
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)
awk '{print $0; fflush}' /cfg/$sysname/fsconfig >/dev/fs/ctl
}
if not {
for(disk) {
setup $disk
}
}
|