]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/mountcwfs
add cpu server to the installer; add more files for cpu server; make sure they are...
[plan9front.git] / rc / bin / inst / mountcwfs
1 #!/bin/rc
2
3 # desc: choose and mount file system partition
4 # prereq: systype
5
6 switch($1){
7 case go
8         echo
9         echo The please choose your $fstype partitions
10         echo
11
12         files=(`{ls /dev/sd*/fscache* /dev/fs/fscache* >[2]/dev/null})
13         if(! ~ $#files 0)
14                 ls -l $files
15         echo
16         if(~ $#files 1)
17                 default=(-d $files)
18         if not
19                 default=()
20         prompt $default 'Cwfs cache partition' $files
21         fs=$rd
22         export fs
23
24         files=(`{ls /dev/sd*/fsworm* /dev/fs/fsworm* >[2]/dev/null})
25         if(! ~ $#files 0)
26                 ls -l $files
27         echo
28         if(~ $#files 1)
29                 default=(-d $files)
30         if not
31                 default=()
32         prompt $default 'Cwfs worm partition' $files
33         fsworm=$rd
34         export fsworm
35
36         files=(`{ls /dev/sd*/other* /dev/fs/other* >[2]/dev/null})
37         if(! ~ $#files 0)
38                 ls -l $files
39         echo
40         if(~ $#files 1)
41                 default=(-d $files)
42         if not
43                 default=()
44         prompt $default 'Cwfs other partition' $files
45         fsother=$rd
46         export fsother
47
48         ream=no
49         if(! ~ $fstype `{fstype $fs})
50                 ream=yes
51         prompt -d $ream 'Ream the filesystem?' yes no
52         ream=$rd
53
54         log Starting $fstype file server for $fs
55         unmount /n/newfs >[2]/dev/null
56         echo halt >>/srv/cwfs.cmd >[2]/dev/null
57         rm -f /srv/cwfs /srv/cwfs.cmd
58
59         if(~ $ream yes){
60                 if(! test -f /tmp/fsconfig){
61                         {
62                                 echo service cwfs
63                                 echo config $fs
64
65                                 if(! ~ $syst cpu){
66                                         # new config option
67                                         echo noauth
68                                 }
69
70                                 echo filsys main c'('$fs')('$fsworm')'
71                                 echo filsys dump o
72                                 if(! ~ $fsother ''){
73                                         echo filsys other '('$fsother')'
74                                         echo ream other
75                                 }
76                                 echo ream main
77                                 echo end
78                         } >/tmp/fsconfig
79                 }
80                 echo 'Reaming filesystem'
81                 if(! $fstype -f $fs -c </tmp/fsconfig){
82                         mountfs=ready
83                         export mountfs
84                         exit oops
85                 }
86         }
87         if not {
88                 echo 'Entering manual configuration mode. when done, type end'
89                 if(! $fstype -n cwfs -f $fs -c){
90                         mountfs=ready
91                         export mountfs
92                         exit oops
93                 }
94         }
95
96         log Configuering $fstype file server for $fs
97         {
98                 echo allow
99                 echo users default
100                 echo cfs main
101                 echo create /adm adm adm 775 d
102                 echo create /adm/users adm adm 664
103                 echo create /dist sys sys 775 d
104                 echo create /usr sys sys 775 d
105                 echo newuser adm +bootes
106                 echo newuser sys +bootes
107                 echo newuser upas +bootes
108                 echo newuser $user
109                 echo newuser adm +$user
110                 echo newuser sys +$user
111                 echo newuser upas +$user
112                 if(! ~ $fsother ''){
113                         echo cfs other
114                         echo create /dist sys sys 775 d
115                         echo create /usr sys sys 775 d
116                         echo create /usr/bootes bootes bootes 775 d
117                         echo create /usr/bootes/tmp bootes bootes 750 d
118                         echo create /usr/$user $user $user 775 d
119                         echo create /usr/$user/tmp $user $user 750 d
120                         echo cfs main
121                 }
122         } >>/srv/cwfs.cmd
123         sleep 5
124
125         log Mounting $fstype file server for $fs
126         if(! logprog mount -c /srv/cwfs /n/newfs){
127                 mountfs=ready
128                 export mountfs
129                 exit
130         }
131         if(! ~ $fsother ''){
132                 log Mounting $fstype file server for $fsother
133                 if(logprog mount -c /srv/cwfs /n/other other)
134                         bind -qc /n/other/dist /n/newfs/dist
135         }
136
137 case checkready checkdone
138         if(! ~ $fstype '' && ~ $#fs 1 && test -f $fs){
139                 if(test -f /srv/cwfs && test -d /n/newfs/dist){
140                         mountfs=done
141                         export mountfs
142                         exit
143                 }
144         }
145         mountfs=ready
146         export mountfs
147         exit
148 }