]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/bootwinnt
fix manual (book) build, add files/permissions for lp, compile postscript
[plan9front.git] / rc / bin / inst / bootwinnt
1 #!/bin/rc
2
3 if(! c: || ! test -f /n/c:/boot.ini) {
4         echo 'Could not find NT''s boot.ini on the first FAT disk.'
5         exit bad
6 }
7
8 if(test -f /n/c:/boot.p9) {
9         echo 'A Plan 9 backup already exists; will not edit boot.ini again.'
10         exit bad
11 }
12
13 if(! cp /n/c:/boot.ini /n/c:/boot.p9) {
14         echo 'Could not back up boot.ini; will not continue.'
15         exit bad
16 }
17
18 chmod +w /n/c:/boot.ini
19
20 if(! grep -si '\[operating systems\]' /n/c:/boot.ini) {
21         echo 'Could not parse boot.ini.'
22         exit bad
23 }
24
25 if(grep -si 'Plan 9' /n/c:/boot.ini) {
26         p9file=`{grep 'Plan 9' /n/c:/boot.ini | sed 1q | sed 's/=.*//'}
27         if(! ~ $p9file [Cc]:'\'*) {
28                 echo 'Unexpected Plan 9 entry in boot.ini already; not continuing.'
29                 exit bad
30         }
31 }
32
33 if not {
34         p9file='c:\bootsect.p9'
35         echo 'c:\bootsect.p9 = "Plan 9 from Bell Labs"\r' >>/n/c:/boot.ini
36 }
37
38 p9file=/n/^`{echo $p9file | sed 's!\\!/!g'}
39
40
41 if(dd -if /dev/$disk/plan9 -bs 512 -count 1 -of $p9file >/dev/null >[2]/dev/null) {
42         echo 'Plan 9 added to Windows NT boot menu.'
43         exit ''
44 }
45
46 echo 'Error copying Plan 9 boot sector to file.'
47 exit bad