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_posix/sys/lib/dist/pc/inst/partdisk – 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: edit partition tables (e.g., to create a plan 9 partition)
4
# prereq: configfs
5
 
6
switch($1){
7
case go
8
	disks=`{ls /dev/sd*/data >[2]/dev/null | sed 's!/dev/(sd..)/data!\1!'}
9
	if(~ $#disks 0) {
10
		echo 'No disk devices were found on your system.'
11
		echo 'The installation process cannot continue.'
12
		exit giveup
13
	}
14
 
15
	echo 'The following disk devices were found.'
16
	echo
17
	for(i in $disks) {
18
		desc=`{cat /dev/$i/ctl | sed 1q | sed 's/inquiry //'}
19
		echo $i '-' $desc
20
		echo e | disk/fdisk -r /dev/$i/data >[2]/dev/null | grep -v '^   mbr'
21
		echo
22
	}
23
 
24
	okay=no
25
	defdisk=$disks(1)
26
 
27
	if(~ $#disks 1)
28
		default=(-d $disks)
29
	if not
30
		default=()
31
	prompt $default 'Disk to partition' $disks
32
	disk=$rd
33
 
34
	if(! hasmbr /dev/$disk/data) {
35
		echo 'The disk you selected HAS NO master boot record on its first sector.'
36
		echo '(Perhaps it is a completely blank disk.)'
37
		echo 'You need a master boot record to use the disk.'
38
		echo 'Should we install a default master boot record?'
39
		echo
40
		prompt 'Install mbr' y n
41
		switch($rd) {
42
		case y
43
			disk/mbr -m /386/mbr /dev/$disk/data
44
			pickdisk=done
45
		}
46
	}
47
	echo
48
	echo 'This is disk/fdisk; use it to create a Plan 9 partition.'
49
	echo 'If there is enough room, a Plan 9 partition will be'
50
	echo 'suggested; you can probably just type ''w'' and then ''q''.'
51
	echo
52
	disk/fdisk -a /dev/$disk/data
53
	disk/fdisk -p /dev/$disk/data >/dev/$disk/ctl >[2]/dev/null
54
	for(i in /dev/sd*/plan9*){
55
		if(test -f $i){
56
			d=`{basename -d $i}
57
			disk/prep -p $i >$d/ctl >[2]/dev/null
58
		}
59
	}
60
 
61
case checkdone
62
	# we want at least one disk with both an mbr and a plan9 partition
63
	mbrandplan9=0
64
	disks=`{ls /dev/sd*/plan9 >[2]/dev/null | sed 's!/dev/(sd..)/plan9!\1!'}
65
	for(disk in $disks) {
66
		if(hasmbr /dev/$disk/data)
67
			mbrandplan9=1
68
	}
69
	if(~ $mbrandplan9 0){
70
		partdisk=notdone
71
		export partdisk
72
	}
73
}