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/feature_fixcpp/sys/lib/dist/pc/inst/bootsetup – 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
# desc: create a boot floppy or configure hard disk to boot plan 9
4
# prereq: copydist
5
 
6
switch($1) {
7
case go
8
	echo
9
	echo 'Initializing Plan 9 FAT configuration partition (9fat)'
10
	echo
11
 
12
	fat=(/dev/sd*/9fat)
13
	fat=$fat(1)
14
	disk=`{echo $fat | sed 's:/dev/::;s:/9fat::'}
15
	bootfs=`{echo $fs | sed 's:/dev/(sd..)/(.*):\1!\2:'}
16
	bootfat=`{echo $fs | sed 's:/dev/(sd..)/(.*):\1!9fat:'}
17
	if(! test -f /dev/$disk/9fat) {
18
		echo 'You have no 9fat partition.  Can''t setup booting.'
19
		exit
20
	}
21
 
22
	if(! test -f /tmp/plan9.ini) {
23
		{
24
			sfs=`{echo $fs | sed 's;/dev;#S;'}
25
			if(~ $fstype fossil fossil+venti){
26
				echo bootfile'='$bootfat!9pcf
27
				echo 'bootargs=local!'^$sfs
28
				echo 'bootdisk=local!'^$sfs
29
			}
30
			if not {
31
				echo bootfile'='$bootfs!/386/9pcdisk
32
				echo 'bootdisk=local!'^$sfs
33
			}
34
			if(~ $fstype fossil+venti){
35
				venti=`{echo $ventiarena | sed 's;/dev;#S;'}
36
				echo venti'='^$venti
37
			}
38
			# sort -u avoids dups which could otherwise trigger
39
			# pointless boot menus.
40
			grep -v '(^\[)|menuitem|adisk|bootfile|bootdisk|bootargs|nobootprompt|mouseport|vgasize|monitor|cdboot' /tmp/plan9.orig |
41
				sort -u
42
			echo 'mouseport='^$mouseport
43
			echo 'monitor='^$monitor
44
			echo 'vgasize='^$vgasize
45
		} >/tmp/plan9.ini
46
	}
47
	if(! test -f /tmp/plan9ini.bak)
48
		cp /tmp/plan9.ini /tmp/plan9ini.bak
49
 
50
	need9fatformat=no
51
	if(! isfat /dev/$disk/9fat)
52
		need9fatformat=yes
53
	if not if(! mount -c /srv/dos /n/9fat /dev/$disk/9fat >[2]/dev/null)
54
		need9fatformat=yes
55
	if not if(! test -f /n/9fat/plan9.ini)
56
		need9fatformat=yes
57
 
58
	if (test -e  /n/newfs/386/9loadnousb)
59
		bind /n/newfs/386/9loadnousb /n/newfs/386/9load	# cater to old bioses
60
	if(~ $need9fatformat yes){
61
		log Initializing Plan 9 FAT partition.
62
		disk/format -r 2 -d -b /386/pbs \
63
			/dev/$disk/9fat /n/newfs/386/9load
64
		# silently install pbslba if the partition is way into the disk.
65
		# it''s our only hope.  only need this for >8.5GB into the disk.
66
		# but...
67
		# there are so few non-LBA bioses out
68
		# there anymore that we'll do this even if we're only 2GB into
69
		# the disk.  it's just not worth the headaches of dealing with
70
		# crappy bioses that don't address the whole 8.5GB properly
71
 
72
		9fatoffset=`{grep '^part 9fat ' /dev/$disk/ctl | awk '{print $4}'}
73
		if(! ~ $#9fatoffset 1) {
74
			echo 'could not find plan 9 partition.'
75
			echo 'cannot happen'
76
			exit bad
77
		}
78
		if(test $9fatoffset -gt 2097152)	# 2GB
79
			disk/format -b /386/pbslba /dev/$disk/9fat
80
 
81
		mount -c /srv/dos /n/9fat /dev/$disk/9fat
82
	}
83
 
84
	if(! test -f /n/9fat/4e){
85
		logprog cp /n/newfs/386/9load /n/9fat/9load
86
		logprog cp /n/newfs/386/9pcf /n/9fat/9pcf
87
		if(test -f /n/9fat/plan9.ini && ! test -f /n/9fat/plan9-3e.ini)
88
			logprog mv /n/9fat/plan9.ini /n/9fat/plan9-3e.ini
89
		if(test -f /n/9fat/9pcdisk && ! test -f /n/9fat/9pc3e)
90
			logprog mv /n/9fat/9pcdisk /n/9fat/9pc3e
91
 
92
		awk -f /bin/inst/mkini.awk >/n/9fat/plan9.ini
93
		>/n/9fat/4e
94
	}
95
 
96
	echo
97
	echo 'There are myriad ways to boot a Plan 9 system.'
98
	echo 'You can use any of the following.'
99
	echo
100
	echo '  floppy - create a boot floppy'
101
	echo '  plan9  - make the plan 9 disk partition the default for booting'
102
	echo '  win9x  - add a plan 9 option to windows 9x boot menu'
103
	echo '  winnt  - add a plan 9 option to windows nt/2000/xp boot manager'
104
	echo
105
	echo 'If you are upgrading an extant third edition installation and booting'
106
	echo 'from something other than a floppy, you needn''t run anything here.'
107
	echo 'Just type ctl-d.'
108
 
109
	oldbootsetup=$didbootsetup
110
	didbootsetup=1
111
	export didbootsetup
112
	prompt 'Enable boot method' floppy plan9 win9x winnt
113
 
114
	if(! boot$rd){
115
		didbootsetup=$oldbootsetup
116
		export didbootsetup
117
	}
118
 
119
case checkdone
120
	xxxfat=(/dev/sd*/9fat)
121
	if(! isfat $xxxfat(1) || ! ~ $didbootsetup 1){
122
		bootsetup=ready
123
		export bootsetup
124
	}
125
}