#!/bin/rc
# desc: choose and mount file system partition
+# prereq: systype
+
+service=cwfs
switch($1){
case go
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
- }
+ ream=no
+ if(! ~ $fstype `{fstype $fs})
+ ream=yes
+ prompt -d $ream 'Ream the filesystem?' yes no
+ ream=$rd
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 -f $fs </tmp/fsconfig){
- mountfs=ready
- export mountfs
- exit oops
+ echo halt >>/srv/$service.cmd >[2]/dev/null
+ rm -f /srv/$service /srv/$service.cmd
+
+ if(~ $ream yes){
+ if(! test -f /tmp/fsconfig){
+ {
+ echo service $service
+ echo config $fs
+
+ if(! ~ $syst cpu){
+ # 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
+ }
+ echo 'Reaming filesystem'
+ if(! $fstype -f $fs -c </tmp/fsconfig){
+ mountfs=ready
+ export mountfs
+ exit oops
+ }
+ }
+ if not {
+ echo 'Entering manual configuration mode. when done, type end'
+ if(! $fstype -n $service -f $fs -c){
+ mountfs=ready
+ export mountfs
+ exit oops
+ }
}
log Configuering $fstype file server for $fs
{
+ echo noattach
echo allow
echo users default
echo cfs main
echo create /adm adm adm 775 d
echo create /adm/users adm adm 664
+ echo create /dist sys sys 775 d
echo create /usr sys sys 775 d
echo newuser $user
- echo newuser sys +$user
echo newuser adm +$user
+ echo newuser sys +$user
+ echo newuser upas +$user
if(! ~ $fsother ''){
echo cfs other
+ echo create /dist sys sys 775 d
echo create /usr sys sys 775 d
echo create /usr/$user $user $user 775 d
echo create /usr/$user/tmp $user $user 750 d
echo cfs main
}
- # not synchronized
- sleep 5
- } >>/srv/cwfs.cmd
+ echo noattach
+ sleep 2
+ } >>/srv/$service.cmd
log Mounting $fstype file server for $fs
- if(! logprog mount -c /srv/cwfs /n/newfs){
- mountfs=ready
- export mountfs
- exit
+ while(! logprog mount -c /srv/$service /n/newfs)
+ sleep 2
+ if(! ~ $fsother ''){
+ log Mounting $fstype file server for $fsother
+ if(logprog mount -c /srv/$service /n/other other)
+ bind -qc /n/other/dist /n/newfs/dist
}
case checkready checkdone
if(! ~ $fstype '' && ~ $#fs 1 && test -f $fs){
- if(! test -f /srv/cwfs){
- logprog $fstype -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){
+ if(test -f /srv/$service && test -d /n/newfs/dist){
mountfs=done
export mountfs
exit