summaryrefslogtreecommitdiff
path: root/rc/bin/inst/mountfossil
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/mountfossil
parent7208d528bd42f981f2535403f72e4c0d7d8df643 (diff)
downloadplan9front-67e93d6a0a4f15192638e131413b9d64c4269c76.tar.xz
updating cwfs and moving installer in /rc/bin
Diffstat (limited to 'rc/bin/inst/mountfossil')
-rwxr-xr-xrc/bin/inst/mountfossil104
1 files changed, 104 insertions, 0 deletions
diff --git a/rc/bin/inst/mountfossil b/rc/bin/inst/mountfossil
new file mode 100755
index 000000000..e98a3f48c
--- /dev/null
+++ b/rc/bin/inst/mountfossil
@@ -0,0 +1,104 @@
+#!/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
+}
+
+