Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/planix-v0/rc/bin/pc/bootplan9 – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/bin/rc
2
 
3
rfork e
4
 
5
. /rc/bin/pc/defs
6
 
7
if(! ~ $#* 1) {
8
	echo 'usage: bootplan9 /dev/sdC0' >[1=2]
9
	echo 'sets active the plan 9 partition on the named disk.' >[1=2]
10
	exit usage
11
}
12
 
13
disk=$1
14
 
15
fn x {
16
	if(! test -f $disk/$1) {
17
		echo 'could not find '$disk/$1
18
		exit disk
19
	}
20
}
21
 
22
x plan9
23
x data
24
x ctl
25
 
26
diskbase=`{basename `{cleanname $disk}}
27
 
28
first=`{ls -p '#S' | sed 1q}
29
if(! ~ $first $diskbase) {
30
	echo 'warning: The plan 9 partition is not on the boot disk,' >[1=2]
31
	echo 'so making it the active partition will have no effect.' >[1=2]
32
}
33
 
34
p9offset=`{disk/fdisk -p $disk/data |grep '^part plan9 ' | awk '{print $4}'}
35
if(! ~ $#p9offset 1) {
36
	echo 'could not find plan 9 partition.' >[1=2]
37
	echo 'cannot happen' >[1=2]
38
	exit bad
39
}
40
 
41
if(test $p9offset -gt 4128705) {	# 65536 * 63
42
	echo  >[1=2]
43
	echo 'Your Plan 9 partition is more than 2GB into your disk,' >[1=2]
44
	echo 'and the master boot records used by most operating systems' >[1=2]
45
	echo 'cannot access it (and thus cannot boot it).' >[1=2]
46
	echo >[1=2]
47
	echo 'Would you like to install a master boot record' >[1=2]
48
	echo 'that will be able to access partitions more than 2GB into the disk?' >[1=2]
49
	echo >[1=2]
50
	prompt 'Install a new mbr' y n 
51
	switch($rd) {
52
	case n
53
		echo >[1=2]
54
		echo 'Not setting Plan 9 partition active, then.' >[1=2]
55
		echo >[1=2]
56
		exit bad
57
	case y
58
		disk/mbr -m /386/mbr $disk/data
59
	}
60
}
61
 
62
p9part=`{disk/fdisk $disk/data >[2]/dev/null </dev/null | 
63
		grep PLAN9 | sed 1q | sed 's/ *(p.) .*/\1/'}
64
if(~ $#p9part 1) {
65
	{ echo 'A '^$p9part; echo w } | disk/fdisk $disk/data >[2]/dev/null >/dev/null
66
}
67
if not {
68
	echo 'Could not find Plan 9 partition.'
69
	exit notdone
70
}
71
 
72
exit