summaryrefslogtreecommitdiff
path: root/rc/bin/inst/bootplan9
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-04-12 15:53:55 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-04-12 15:53:55 +0000
commit67e93d6a0a4f15192638e131413b9d64c4269c76 (patch)
tree88fd1d17c4be283683a96ced44159e3ce6b6f2f7 /rc/bin/inst/bootplan9
parent7208d528bd42f981f2535403f72e4c0d7d8df643 (diff)
updating cwfs and moving installer in /rc/bin
Diffstat (limited to 'rc/bin/inst/bootplan9')
-rwxr-xr-xrc/bin/inst/bootplan955
1 files changed, 55 insertions, 0 deletions
diff --git a/rc/bin/inst/bootplan9 b/rc/bin/inst/bootplan9
new file mode 100755
index 000000000..942c043b0
--- /dev/null
+++ b/rc/bin/inst/bootplan9
@@ -0,0 +1,55 @@
+#!/bin/rc
+
+first=`{ls -p '#S' | sed 1q}
+if(! ~ $first $disk) {
+ echo 'warning: The plan 9 partition is not on the boot disk,'
+ echo 'so making it the active partition will have no effect.'
+}
+
+p9offset=`{grep '^part 9fat ' /dev/$disk/ctl |awk '{print $3}'}
+if(! ~ $#p9offset 1) {
+ echo 'could not find plan 9 partition.'
+ echo 'cannot happen'
+ exit bad
+}
+
+if(test $p9offset -gt 4128695) { # 65536 * 63 - 10
+ echo
+ echo 'Your Plan 9 partition is more than 2GB into your disk,'
+ echo 'and the master boot records used by Windows 9x/ME'
+ echo 'cannot access it (and thus cannot boot it).'
+ echo
+ echo 'You can install the Plan 9 master boot record, which can load'
+ echo 'partitions far into the disk.'
+ echo
+}
+
+echo 'If you use the Windows NT/2000/XP master boot record'
+echo 'or a master boot record from a Unix clone (e.g., LILO or'
+echo 'FreeBSD bootmgr), it is probably safe to continue using'
+echo 'that boot record rather than install the Plan 9 boot record.'
+echo
+prompt 'Install the Plan 9 master boot record' y n
+switch($rd) {
+case n
+ ;
+case y
+ disk/mbr -m /386/mbr /dev/$disk/data
+}
+
+log Setting Plan 9 partition active.
+p9part=`{disk/fdisk /dev/$disk/data >[2]/dev/null </dev/null |
+ grep PLAN9 | sed 1q | sed 's/ *(p.) .*/\1/'}
+if(~ $#p9part 0){
+ echo 'You have no Plan 9 partitions (How could this happen?)' >[1=2]
+ exit 'no plan 9 partition found'
+}
+p9part=$p9part(1)
+{ echo 'A '^$p9part; echo w } | disk/fdisk /dev/$disk/data >[2]/dev/null >/dev/null
+x=$status
+if(~ $x '' '|'){
+ echo
+ echo 'The Plan 9 partition is now marked as active.'
+ exit ''
+}
+exit $x