105 lines
2.5 KiB
Text
105 lines
2.5 KiB
Text
|
#!/bin/rc
|
||
|
|
||
|
switch($1){
|
||
|
case checkready checkdone
|
||
|
if(! ~ $fmtfossil done){
|
||
|
mountfs=notdone
|
||
|
export mountfs
|
||
|
exit
|
||
|
}
|
||
|
if(! test -f /dev/sd*/fossil* && ! test -f /dev/fs/fossil*){
|
||
|
mountfs=notdone
|
||
|
export mountfs
|
||
|
exit
|
||
|
}
|
||
|
if(! ~ $#fossil 1 || ! test -f $fossil){
|
||
|
mountfs=ready
|
||
|
export mountfs
|
||
|
exit
|
||
|
}
|
||
|
if(! ps | grep -s ' fossil$'){
|
||
|
echo 'srv -p fscons' > /env/fossilconf
|
||
|
echo 'srv -AP fossil' >> /env/fossilconf
|
||
|
fossil/conf $fossil | sed 's/^fsys main open .*/& -AWVP/' |
|
||
|
sed 's/^fsys main snaptime .*//' >> /env/fossilconf
|
||
|
if(! logprog fossil/fossil -c .' /env/fossilconf'>>[2]/srv/log){
|
||
|
echo 'fossil: '^$status
|
||
|
mountfs=ready
|
||
|
export mountfs
|
||
|
exit oops
|
||
|
}
|
||
|
if(! test -f /srv/fossil){
|
||
|
echo 'fossil did not create /srv/fossil'
|
||
|
mountfs=ready
|
||
|
exit oops
|
||
|
}
|
||
|
cat /srv/fscons >>/srv/log &
|
||
|
if(! logprog mount -c /srv/fossil /n/newfs){
|
||
|
echo 'mount: '^$status
|
||
|
mountfs=ready
|
||
|
export mountfs
|
||
|
exit oops
|
||
|
}
|
||
|
fs=$fossil
|
||
|
export fs
|
||
|
}
|
||
|
if(! test -s /n/newfs/adm/users){
|
||
|
echo fsys main create /active/adm adm sys d775 >>/srv/fscons
|
||
|
echo fsys main create /active/adm/users adm sys 664 >>/srv/fscons
|
||
|
echo uname upas :upas >>/srv/fscons
|
||
|
echo users -w >>/srv/fscons
|
||
|
sleep 2
|
||
|
}
|
||
|
if(! test -s /n/newfs/adm/users){
|
||
|
echo 'could not create /adm/users'
|
||
|
mountfs=ready
|
||
|
export mountfs
|
||
|
exit oops
|
||
|
}
|
||
|
for(i in dist dist/replica dist/replica/client){
|
||
|
if(! test -d /n/newfs/$i)
|
||
|
echo fsys main create /active/$i sys sys d775 >>/srv/fscons
|
||
|
sleep 2
|
||
|
}
|
||
|
if(! test -d /n/newfs/dist/replica/client){
|
||
|
echo 'could not create /dist/replica/client'
|
||
|
mountfs=ready
|
||
|
export mountfs
|
||
|
exit oops
|
||
|
}
|
||
|
if(! test -e /n/newfs/dist/replica/client/plan9.db){
|
||
|
echo fsys main create /active/dist/replica/client/plan9.db sys sys 664 >>/srv/fscons
|
||
|
echo fsys main create /active/dist/replica/client/plan9.log sys sys a664 >>/srv/fscons
|
||
|
}
|
||
|
if(test -d /n/newfs/dist/replica/client && test -f /n/newfs/adm/users){
|
||
|
mountfs=done
|
||
|
export mountfs
|
||
|
exit
|
||
|
}
|
||
|
mountfs=ready
|
||
|
export mountfs
|
||
|
exit
|
||
|
|
||
|
case go
|
||
|
echo 'The following partitions named fossil* 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*/fossil* /dev/fs/fossil* >[2]/dev/null})
|
||
|
ls -l $files
|
||
|
echo
|
||
|
if(~ $#fossil 1 && ~ $fossil $files)
|
||
|
default=(-d $fossil)
|
||
|
if not if(~ $#files 1)
|
||
|
default=(-d $files)
|
||
|
if not
|
||
|
default=()
|
||
|
prompt $default 'Fossil partition' $files
|
||
|
slay fossil|rc
|
||
|
fossil=$rd
|
||
|
export fossil
|
||
|
}
|
||
|
|
||
|
|