]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/mountfossil
Change installer to use statusbar(8) instead of bargraph and remove the latter.
[plan9front.git] / rc / bin / inst / mountfossil
1 #!/bin/rc
2
3 switch($1){
4 case checkready checkdone
5         if(! ~ $fmtfossil done){
6                 mountfs=notdone
7                 export mountfs
8                 exit
9         }
10         if(! test -f /dev/sd*/fossil* && ! test -f /dev/fs/fossil*){
11                 mountfs=notdone
12                 export mountfs
13                 exit
14         }
15         if(! ~ $#fossil 1 || ! test -f $fossil){
16                 mountfs=ready
17                 export mountfs
18                 exit
19         }
20         if(! ps | grep -s ' fossil$'){
21                 echo 'srv -p fscons' > /env/fossilconf
22                 echo 'srv -AP fossil' >> /env/fossilconf
23                 fossil/conf $fossil | sed 's/^fsys main open .*/& -AWVP/' |
24                         sed 's/^fsys main snaptime .*//' >> /env/fossilconf
25                 if(! logprog fossil/fossil -c .' /env/fossilconf'>>[2]/srv/log){
26                         echo 'fossil: '^$status
27                         mountfs=ready
28                         export mountfs
29                         exit oops
30                 }
31                 if(! test -f /srv/fossil){
32                         echo 'fossil did not create /srv/fossil'
33                         mountfs=ready
34                         exit oops
35                 }
36                 cat /srv/fscons >>/srv/log &
37                 if(! logprog mount -c /srv/fossil /n/newfs){
38                         echo 'mount: '^$status
39                         mountfs=ready
40                         export mountfs
41                         exit oops
42                 }
43                 fs=$fossil
44                 export fs
45         }
46         if(! test -s /n/newfs/adm/users){
47                 echo fsys main create /active/adm adm sys d775 >>/srv/fscons
48                 echo fsys main create /active/adm/users adm sys 664 >>/srv/fscons
49                 echo uname upas :upas >>/srv/fscons
50                 echo users -w >>/srv/fscons
51                 sleep 2
52         }
53         if(! test -s /n/newfs/adm/users){
54                 echo 'could not create /adm/users'
55                 mountfs=ready
56                 export mountfs
57                 exit oops
58         }
59         for(i in dist dist/replica dist/replica/client){
60                 if(! test -d /n/newfs/$i)
61                         echo fsys main create /active/$i sys sys d775 >>/srv/fscons
62                 sleep 2
63         }
64         if(! test -d /n/newfs/dist/replica/client){
65                 echo 'could not create /dist/replica/client'
66                 mountfs=ready
67                 export mountfs
68                 exit oops
69         }
70         if(! test -e /n/newfs/dist/replica/client/plan9.db){
71                 echo fsys main create /active/dist/replica/client/plan9.db sys sys 664 >>/srv/fscons
72                 echo fsys main create /active/dist/replica/client/plan9.log sys sys a664 >>/srv/fscons
73         }
74         if(test -d /n/newfs/dist/replica/client && test -f /n/newfs/adm/users){
75                 mountfs=done
76                 export mountfs
77                 exit
78         }
79         mountfs=ready
80         export mountfs
81         exit
82
83 case go
84         echo 'The following partitions named fossil* were found.'
85         echo
86         echo 'Please choose one to use as the installation file system'
87         echo 'for your Plan 9 installation.'
88         echo
89         files=(`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null})
90         ls -l $files
91         echo
92         if(~ $#fossil 1 && ~ $fossil $files)
93                 default=(-d $fossil)
94         if not if(~ $#files 1)
95                 default=(-d $files)
96         if not
97                 default=()
98         prompt $default 'Fossil partition' $files
99         slay fossil|rc
100         fossil=$rd
101         export fossil
102 }
103
104