inst: installer adaption to cwfs
This commit is contained in:
parent
b14bc93a79
commit
40dab914b7
9 changed files with 151 additions and 219 deletions
|
@ -1,11 +1,5 @@
|
|||
#!/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.'
|
||||
|
|
|
@ -12,33 +12,15 @@ case go
|
|||
fat=(/dev/sd*/9fat)
|
||||
fat=$fat(1)
|
||||
disk=`{echo $fat | sed 's:/dev/::;s:/9fat::'}
|
||||
bootfs=`{echo $fs | sed 's:/dev/(sd..)/(.*):\1!\2:'}
|
||||
bootfat=`{echo $fs | sed 's:/dev/(sd..)/(.*):\1!9fat:'}
|
||||
if(! test -f /dev/$disk/9fat) {
|
||||
if(! test -f $fat) {
|
||||
echo 'You have no 9fat partition. Can''t setup booting.'
|
||||
exit
|
||||
}
|
||||
|
||||
if(! test -f /tmp/plan9.ini) {
|
||||
{
|
||||
sfs=`{echo $fs | sed 's;/dev;#S;'}
|
||||
if(~ $fstype fossil cwfs){
|
||||
echo bootfile'='$bootfat!9pcf
|
||||
echo 'bootargs=local!'^$sfs
|
||||
echo 'bootdisk=local!'^$sfs
|
||||
}
|
||||
if not {
|
||||
echo bootfile'='$bootfs!/386/9pcdisk
|
||||
echo 'bootdisk=local!'^$sfs
|
||||
}
|
||||
if(~ $fstype fossil+venti){
|
||||
venti=`{echo $ventiarena | sed 's;/dev;#S;'}
|
||||
echo venti'='^$venti
|
||||
}
|
||||
# sort -u avoids dups which could otherwise trigger
|
||||
# pointless boot menus.
|
||||
grep -v '(^\[)|menuitem|adisk|bootfile|bootdisk|bootargs|nobootprompt|mouseport|vgasize|monitor|cdboot' /tmp/plan9.orig |
|
||||
sort -u
|
||||
echo bootfile'='9pcf
|
||||
echo 'bootargs=local!'^$fs
|
||||
echo 'mouseport='^$mouseport
|
||||
echo 'monitor='^$monitor
|
||||
echo 'vgasize='^$vgasize
|
||||
|
@ -48,8 +30,10 @@ case go
|
|||
cp /tmp/plan9.ini /tmp/plan9ini.bak
|
||||
|
||||
need9fatformat=no
|
||||
if(! isfat /dev/$disk/9fat)
|
||||
if(! isfat $fat)
|
||||
need9fatformat=yes
|
||||
if(! test -f /srv/dos)
|
||||
dossrv
|
||||
if not if(! mount -c /srv/dos /n/9fat /dev/$disk/9fat >[2]/dev/null)
|
||||
need9fatformat=yes
|
||||
if not if(! test -f /n/9fat/plan9.ini)
|
||||
|
@ -57,22 +41,15 @@ case go
|
|||
|
||||
if(~ $need9fatformat yes){
|
||||
log Initializing Plan 9 FAT partition.
|
||||
disk/format -r 2 -d -b /386/pbs \
|
||||
/dev/$disk/9fat /n/newfs/386/9bootfat
|
||||
mount -c /srv/dos /n/9fat /dev/$disk/9fat
|
||||
disk/format -r 2 -d -b /386/pbs $fat /n/newfs/386/9bootfat
|
||||
mount -c /srv/dos /n/9fat $fat
|
||||
}
|
||||
|
||||
if(! test -f /n/9fat/4e){
|
||||
logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
|
||||
logprog cp /n/newfs/386/9pcf /n/9fat/9pcf
|
||||
if(test -f /n/9fat/plan9.ini && ! test -f /n/9fat/plan9-3e.ini)
|
||||
logprog mv /n/9fat/plan9.ini /n/9fat/plan9-3e.ini
|
||||
if(test -f /n/9fat/9pcdisk && ! test -f /n/9fat/9pc3e)
|
||||
logprog mv /n/9fat/9pcdisk /n/9fat/9pc3e
|
||||
|
||||
awk -f /bin/inst/mkini.awk >/n/9fat/plan9.ini
|
||||
>/n/9fat/4e
|
||||
}
|
||||
logprog cp /tmp/plan9.ini /n/9fat/plan9.ini
|
||||
if(test -f /tmp/plan9ini.bak)
|
||||
logprog cp /tmp/plan9ini.bak /n/9fat/plan9ini.bak
|
||||
logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
|
||||
logprog cp /n/newfs/386/9pcf /n/9fat/9pcf
|
||||
|
||||
echo
|
||||
echo 'There are myriad ways to boot a Plan 9 system.'
|
||||
|
|
|
@ -4,19 +4,18 @@
|
|||
|
||||
switch($1){
|
||||
case checkdone
|
||||
if(! ~ $fstype cwfs){
|
||||
if(~ $#fstype 1 && test -f /bin/$fstype)
|
||||
configfs=done
|
||||
if not
|
||||
configfs=ready
|
||||
export configfs
|
||||
}
|
||||
export configfs
|
||||
|
||||
case go
|
||||
echo 'You can install the following types of file systems:'
|
||||
echo
|
||||
echo ' cwfs the cached-worm file server'
|
||||
echo ' cwfs64x the cached-worm file server'
|
||||
echo
|
||||
prompt -d fossil 'File system' cwfs
|
||||
prompt -d cwfs64x 'File system' cwfs64x
|
||||
fstype=$rd
|
||||
export fstype
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,26 +5,23 @@
|
|||
|
||||
switch($1){
|
||||
case checkready
|
||||
if(! test -d /n/dist/dist/replica){
|
||||
if(! test -f /n/dist/LICENSE){
|
||||
copydist=notdone
|
||||
export copydist
|
||||
exit
|
||||
}
|
||||
if(test -f /n/newfs/dist/replica/didplan9){
|
||||
if(test -f /n/newfs/LICENSE && test -f /tmp/copydone){
|
||||
copydist=done
|
||||
export copydist
|
||||
exit
|
||||
}
|
||||
case go
|
||||
inst/watchfd applylog 0 `{ls -l /n/dist/dist/replica/plan9.log | awk '{print $6}'} 'Installing file system' &
|
||||
replica/pull -c / /rc/bin/inst/replcfg
|
||||
if(~ $status '' *conflicts || test -f /n/newfs/dist/replica/didplan9witherrors)
|
||||
>/n/newfs/dist/replica/didplan9
|
||||
if not
|
||||
>/n/newfs/dist/replica/didplan9witherrors
|
||||
rm -f /tmp/copydone
|
||||
disk/mkfs -s /n/dist -d /n/newfs /sys/lib/sysconfig/proto/allproto
|
||||
touch /tmp/copydone
|
||||
|
||||
case checkdone
|
||||
if(! test -f /n/newfs/dist/replica/didplan9){
|
||||
if(! test -f /tmp/copydone){
|
||||
copydist=notdone
|
||||
export copydist
|
||||
}
|
||||
|
|
117
rc/bin/inst/mountcwfs
Normal file
117
rc/bin/inst/mountcwfs
Normal file
|
@ -0,0 +1,117 @@
|
|||
#!/bin/rc
|
||||
|
||||
# desc: choose and mount file system partition
|
||||
|
||||
switch($1){
|
||||
case go
|
||||
echo
|
||||
echo The please choose your $fstype partitions
|
||||
echo
|
||||
|
||||
files=(`{ls /dev/sd*/fscache* /dev/fs/fscache* >[2]/dev/null})
|
||||
ls -l $files
|
||||
echo
|
||||
if(~ $#files 1)
|
||||
default=(-d $files)
|
||||
if not
|
||||
default=()
|
||||
prompt $default 'Cwfs cache partition' $files
|
||||
fs=$rd
|
||||
export fs
|
||||
|
||||
files=(`{ls /dev/sd*/fsworm* /dev/fs/fsworm* >[2]/dev/null})
|
||||
ls -l $files
|
||||
echo
|
||||
if(~ $#files 1)
|
||||
default=(-d $files)
|
||||
if not
|
||||
default=()
|
||||
prompt $default 'Cwfs worm partition' $files
|
||||
fsworm=$rd
|
||||
export fsworm
|
||||
|
||||
files=(`{ls /dev/sd*/other* /dev/fs/other* >[2]/dev/null})
|
||||
ls -l $files
|
||||
echo
|
||||
if(~ $#files 1)
|
||||
default=(-d $files)
|
||||
if not
|
||||
default=()
|
||||
prompt $default 'Cwfs other partition' $files
|
||||
fsother=$rd
|
||||
export fsother
|
||||
|
||||
if(! test -f /tmp/fsconfig){
|
||||
{
|
||||
echo service cwfs
|
||||
echo config $fs
|
||||
|
||||
# new config option
|
||||
echo noauth
|
||||
|
||||
echo filsys main c'('$fs')('$fsworm')'
|
||||
echo filsys dump o
|
||||
if(! ~ $fsother ''){
|
||||
echo filsys other '('$fsother')'
|
||||
echo ream other
|
||||
}
|
||||
echo ream main
|
||||
echo end
|
||||
} >/tmp/fsconfig
|
||||
}
|
||||
|
||||
log Starting $fstype file server for $fs
|
||||
unmount /n/newfs >[2]/dev/null
|
||||
echo halt >>/srv/cwfs.cmd >[2]/dev/null
|
||||
rm -f /srv/cwfs /srv/cwfs.cmd
|
||||
if(! $fstype -c -C -f $fs </tmp/fsconfig){
|
||||
mountfs=ready
|
||||
export mountfs
|
||||
exit oops
|
||||
}
|
||||
|
||||
{
|
||||
echo allow
|
||||
echo users default
|
||||
echo filsys main
|
||||
echo create /adm adm adm 775 d
|
||||
echo create /adm/users adm adm 664
|
||||
echo create /usr sys sys 775 d
|
||||
echo newuser $user
|
||||
echo newuser sys +$user
|
||||
echo newuser adm +$user
|
||||
# not synchronized
|
||||
sleep 5
|
||||
} >>/srv/cwfs.cmd
|
||||
|
||||
log Mounting $fstype file server for $fs
|
||||
if(! logprog mount -c /srv/cwfs /n/newfs){
|
||||
mountfs=ready
|
||||
export mountfs
|
||||
exit
|
||||
}
|
||||
|
||||
case checkready checkdone
|
||||
if(! ~ $fstype '' && ~ $#fs 1 && test -f $fs){
|
||||
if(! test -f /srv/cwfs){
|
||||
logprog $fstype -C -f $fs
|
||||
echo allow >>/srv/cwfs.cmd >>[2]/srv/log
|
||||
}
|
||||
if(test -f /srv/cwfs && ! test -f /n/newfs/adm/users){
|
||||
log Mounting $fstype file server for $fs
|
||||
if(! logprog mount -c /srv/cwfs /n/newfs){
|
||||
mountfs=ready
|
||||
export mountfs
|
||||
exit
|
||||
}
|
||||
}
|
||||
if(test -f /srv/cwfs && test -f /n/newfs/adm/users){
|
||||
mountfs=done
|
||||
export mountfs
|
||||
exit
|
||||
}
|
||||
}
|
||||
mountfs=ready
|
||||
export mountfs
|
||||
exit
|
||||
}
|
|
@ -11,40 +11,12 @@ fn domount{
|
|||
}
|
||||
|
||||
fn exitifdone{
|
||||
if(test -f /n/dist/dist/replica/plan9.db)
|
||||
if(test -f /n/dist/LICENSE)
|
||||
exit
|
||||
}
|
||||
|
||||
fn trycdimage{
|
||||
if(test -f $1){
|
||||
rm -f /srv/9660.dist
|
||||
unmount /n/dist
|
||||
9660srv 9660.dist >[2]/dev/null
|
||||
logprog mount /srv/9660.dist /n/dist $1
|
||||
exitifdone
|
||||
mountdist=notdone
|
||||
export mountdist
|
||||
exit notdone
|
||||
}
|
||||
}
|
||||
|
||||
fn trycdimagebz2 {
|
||||
if(test -f $1){
|
||||
echo -n 'bunzip2 < '^$1^' >/n/newfs/dist/plan9.iso'
|
||||
bunzip2 < $1 >/n/newfs/dist/_plan9.iso &&
|
||||
mv /n/newfs/dist/_plan9.iso /n/newfs/dist/plan9.iso
|
||||
echo
|
||||
trycdimage /n/newfs/dist/plan9.iso
|
||||
mountdist=notdone
|
||||
export mountdist
|
||||
exit notdone
|
||||
}
|
||||
}
|
||||
|
||||
fn havedist {
|
||||
test -f $1/dist/replica/plan9.db ||
|
||||
test -f $1/plan9.iso ||
|
||||
test -f $1/plan9.iso.bz2
|
||||
test -f $1/LICENSE
|
||||
}
|
||||
|
||||
switch($1){
|
||||
|
@ -70,7 +42,6 @@ case go
|
|||
fat=()
|
||||
ext2=()
|
||||
x9660=()
|
||||
fossil=()
|
||||
|
||||
echo Please wait... Scanning storage devices...
|
||||
|
||||
|
@ -86,8 +57,6 @@ case go
|
|||
ext2=($ext2 $i)
|
||||
if(is9660 /tmp/localpart.$n)
|
||||
x9660=($x9660 $i)
|
||||
if(isfossil $i)
|
||||
fossil=($fossil $i)
|
||||
echo
|
||||
}
|
||||
echo
|
||||
|
@ -102,15 +71,13 @@ case go
|
|||
echo ' '^$i^' (linux ext2)'
|
||||
case $x9660
|
||||
echo ' '^$i^' (iso9660 cdrom)'
|
||||
case $fossil
|
||||
echo ' '^$i^' (plan9 fossil)'
|
||||
}
|
||||
}
|
||||
echo
|
||||
|
||||
mountstatus=x
|
||||
while(! ~ $mountstatus ''){
|
||||
prompt -w '' 'Distribution disk' $fat $x9660 $fossil
|
||||
prompt -w '' 'Distribution disk' $fat $x9660
|
||||
disk=$rd
|
||||
|
||||
srvmedia=()
|
||||
|
@ -127,13 +94,6 @@ case go
|
|||
case $x9660
|
||||
srvmedia=(9660srv)
|
||||
mountmedia=(mount /srv/9660 /n/distmedia $disk)
|
||||
case $fossil
|
||||
echo 'srv fossil.mountdist' > /tmp/fossi.conf
|
||||
echo 'fsys main config '^$disk >> /tmp/fossil.conf
|
||||
echo 'fsys main open -AWVP' >> /tmp/fossil.conf
|
||||
echo 'fsys main' >> /tmp/fossil.conf
|
||||
srvmedia=(fossil/fossil -c '. /tmp/fossil.conf')
|
||||
mountmedia=(mount /srv/fossil.mountdist /n/distmedia)
|
||||
case *
|
||||
echo Unknown disk type '(cannot happen)'
|
||||
exit oops
|
||||
|
@ -200,22 +160,14 @@ case checkdone
|
|||
|
||||
exitifdone
|
||||
|
||||
if(test -f /n/distmedia/$distmediadir/dist/replica/plan9.db){
|
||||
if(havedist /n/distmedia/$distmediadir){
|
||||
bind /n/distmedia/$distmediadir /n/dist
|
||||
bind -a /n/dist/386/bin /bin
|
||||
bind -a /n/dist/rc/bin /bin
|
||||
exitifdone
|
||||
mountdist=notdone
|
||||
export mountdist
|
||||
exit notdone
|
||||
}
|
||||
|
||||
trycdimage /n/distmedia/$distmediadir/plan9.iso
|
||||
trycdimage /n/newfs/dist/plan9.iso
|
||||
|
||||
trycdimagebz2 /n/distmedia/$distmediadir/plan9.iso.bz2
|
||||
trycdimagebz2 /n/newfs/dist/plan9.iso.bz2
|
||||
|
||||
mountdist=notdone
|
||||
export mountdist
|
||||
exit notdone
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# prereq: configfs
|
||||
|
||||
switch($fstype){
|
||||
case cwfs
|
||||
case cwfs cwfs64 cwfs64x
|
||||
exec mountcwfs $*
|
||||
case *
|
||||
mountfs=notdone
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
# prereq: partdisk
|
||||
|
||||
fn autotype {
|
||||
if(~ $fstype cwfs)
|
||||
switch($fstype){
|
||||
case cwfs cwfs64 cwfs64x
|
||||
echo -a 9fat -a nvram -a fscache -a fsworm -a other
|
||||
}
|
||||
}
|
||||
|
||||
switch($1) {
|
||||
|
@ -41,16 +43,7 @@ case go
|
|||
case checkdone
|
||||
if(! test -f /dev/sd*/9fat)
|
||||
prepdisk=ready
|
||||
|
||||
if(! ~ $prepdisk ready){
|
||||
if(! ~ $prepdisk ready)
|
||||
prepdisk=done
|
||||
switch($fstype){
|
||||
case cwfs
|
||||
if(! test -f /dev/sd*/fscache* && ! test -f /dev/fs/fscache*)
|
||||
prepdisk=ready
|
||||
if(! test -f /dev/sd*/fsworm* && ! test -f /dev/fs/fsworm*)
|
||||
prepdisk=ready
|
||||
}
|
||||
}
|
||||
export prepdisk
|
||||
}
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
#!/bin/rc
|
||||
|
||||
# desc: choose and mount file system partition
|
||||
|
||||
switch($1){
|
||||
case go
|
||||
echo 'The following partitions named fscache* were found.'
|
||||
echo
|
||||
echo 'Please choose one to use as the installation file system'
|
||||
echo 'for your Plan 9 installation.'
|
||||
echo
|
||||
files=(`{ls /dev/sd*/fscache* /dev/fs/fscache* >[2]/dev/null})
|
||||
ls -l $files
|
||||
echo
|
||||
if(~ $#files 1)
|
||||
default=(-d $files)
|
||||
if not
|
||||
default=()
|
||||
prompt $default 'Cwfs partition to use for Plan 9 installation' $files
|
||||
fs=$rd
|
||||
export fs
|
||||
|
||||
if(! test -f /tmp/fsconfig) {
|
||||
{
|
||||
echo service cwfs
|
||||
echo nvram /dev/sdC0/nvram
|
||||
echo config /dev/sdC0/fscache
|
||||
echo filsys main c'('/dev/sdC0/fscache')'f'('/dev/sdC0/fsworm')'
|
||||
echo filsys dump o
|
||||
echo filsys other '('/dev/sdC0/other')'
|
||||
echo ream main
|
||||
echo ream other
|
||||
echo end
|
||||
} >/tmp/fsconfig
|
||||
}
|
||||
|
||||
log Starting cwfs file server for $fs
|
||||
unmount /n/newfs >[2]/dev/null
|
||||
echo halt >>/srv/cwfs.cmd >[2]/dev/null
|
||||
rm -f /srv/cwfs /srv/cwfs.cmd
|
||||
logprog cwfs -c -C -f $fs </tmp/fsconfig
|
||||
echo allow >>/srv/cwfs.cmd
|
||||
echo noauth >>/srv/cwfs.cmd
|
||||
echo users default >>/srv/cwfs.cmd
|
||||
|
||||
log Mounting cwfs file server for $fs
|
||||
if(! logprog mount -c /srv/cwfs /n/newfs){
|
||||
echo 'mounting cwfs: '^$status
|
||||
exit oops
|
||||
}
|
||||
|
||||
if(test -d /n/newfs/wrap){
|
||||
moveoldfs go
|
||||
if(test -d /n/newfs/wrap)
|
||||
exit cannotsmashold
|
||||
}
|
||||
if(! test -f /n/newfs/dist/replica/client/plan9.log){
|
||||
echo 'create /dist sys sys 775 d' >>/srv/cwfs.cmd
|
||||
echo 'create /dist/replica sys sys 775 d' >>/srv/cwfs.cmd
|
||||
echo 'create /dist/replica/ndist sys sys 775' >>/srv/cwfs.cmd
|
||||
echo 'create /dist/replica/client sys sys 775 d' >>/srv/cwfs.cmd
|
||||
echo 'create /dist/replica/client/plan9.db sys sys 664' >>/srv/cwfs.cmd
|
||||
echo 'create /dist/replica/client/plan9.log sys sys 664 a' >>/srv/cwfs.cmd
|
||||
}
|
||||
|
||||
case checkready checkdone
|
||||
if(! test -f /dev/sd*/fscache*){
|
||||
mountfs=notdone
|
||||
export mountfs
|
||||
exit
|
||||
}
|
||||
if(! ~ $#fs 1 || ! test -f $fs){
|
||||
mountfs=ready
|
||||
export mountfs
|
||||
exit
|
||||
}
|
||||
if(! test -f /srv/cwfs){
|
||||
echo halt >>/srv/cwfs.cmd
|
||||
rm -f /srv/cwfs /srv/cwfs.cmd
|
||||
logprog cwfs -C -f $fs
|
||||
echo allow >>/srv/cwfs.cmd >>[2]/srv/log
|
||||
}
|
||||
if(test -f /srv/cwfs && ! test -f /n/newfs/dist/replica/client/plan9.log){
|
||||
log Mounting cwfs file server for $fs
|
||||
if(! logprog mount -c /srv/cwfs /n/newfs)
|
||||
echo 'mounting cwfs: '^$status
|
||||
echo allow >>/srv/cwfs.cmd >>[2]/srv/log
|
||||
}
|
||||
if(test -f /srv/cwfs && test -f /n/newfs/dist/replica/client/plan9.log){
|
||||
mountfs=done
|
||||
export mountfs
|
||||
exit
|
||||
}
|
||||
mountfs=ready
|
||||
export mountfs
|
||||
exit
|
||||
}
|
Loading…
Reference in a new issue