summaryrefslogtreecommitdiff
path: root/sys/lib/dist.old/pc/inst/partdisk
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-04-11 19:47:05 +0000
committercinap_lenrek <cinap_lenrek@centraldogma>2011-04-11 19:47:05 +0000
commit45bab89362ebe122d60d5e9b1e2b949b26168db3 (patch)
treec430eb677a06d8c823fd1d2d4a9f7790c0c275d2 /sys/lib/dist.old/pc/inst/partdisk
parent05569f6f2c54a19c1c85a7f10742913cd8904787 (diff)
livecd
Diffstat (limited to 'sys/lib/dist.old/pc/inst/partdisk')
-rwxr-xr-xsys/lib/dist.old/pc/inst/partdisk73
1 files changed, 73 insertions, 0 deletions
diff --git a/sys/lib/dist.old/pc/inst/partdisk b/sys/lib/dist.old/pc/inst/partdisk
new file mode 100755
index 000000000..430d45f3f
--- /dev/null
+++ b/sys/lib/dist.old/pc/inst/partdisk
@@ -0,0 +1,73 @@
+#!/bin/rc
+
+# desc: edit partition tables (e.g., to create a plan 9 partition)
+# prereq: configfs
+
+switch($1){
+case go
+ disks=`{ls /dev/sd*/data >[2]/dev/null | sed 's!/dev/(sd..)/data!\1!'}
+ if(~ $#disks 0) {
+ echo 'No disk devices were found on your system.'
+ echo 'The installation process cannot continue.'
+ exit giveup
+ }
+
+ echo 'The following disk devices were found.'
+ echo
+ for(i in $disks) {
+ desc=`{cat /dev/$i/ctl | sed 1q | sed 's/inquiry //'}
+ echo $i '-' $desc
+ echo e | disk/fdisk -r /dev/$i/data >[2]/dev/null | grep -v '^ mbr'
+ echo
+ }
+
+ okay=no
+ defdisk=$disks(1)
+
+ if(~ $#disks 1)
+ default=(-d $disks)
+ if not
+ default=()
+ prompt $default 'Disk to partition' $disks
+ disk=$rd
+
+ if(! hasmbr /dev/$disk/data) {
+ echo 'The disk you selected HAS NO master boot record on its first sector.'
+ echo '(Perhaps it is a completely blank disk.)'
+ echo 'You need a master boot record to use the disk.'
+ echo 'Should we install a default master boot record?'
+ echo
+ prompt 'Install mbr' y n
+ switch($rd) {
+ case y
+ disk/mbr -m /386/mbr /dev/$disk/data
+ pickdisk=done
+ }
+ }
+ echo
+ echo 'This is disk/fdisk; use it to create a Plan 9 partition.'
+ echo 'If there is enough room, a Plan 9 partition will be'
+ echo 'suggested; you can probably just type ''w'' and then ''q''.'
+ echo
+ disk/fdisk -a /dev/$disk/data
+ disk/fdisk -p /dev/$disk/data >/dev/$disk/ctl >[2]/dev/null
+ for(i in /dev/sd*/plan9*){
+ if(test -f $i){
+ d=`{basename -d $i}
+ disk/prep -p $i >$d/ctl >[2]/dev/null
+ }
+ }
+
+case checkdone
+ # we want at least one disk with both an mbr and a plan9 partition
+ mbrandplan9=0
+ disks=`{ls /dev/sd*/plan9 >[2]/dev/null | sed 's!/dev/(sd..)/plan9!\1!'}
+ for(disk in $disks) {
+ if(hasmbr /dev/$disk/data)
+ mbrandplan9=1
+ }
+ if(~ $mbrandplan9 0){
+ partdisk=notdone
+ export partdisk
+ }
+}