2011-04-22 00:50:41 +00:00
|
|
|
#!/bin/rc
|
|
|
|
|
|
|
|
# desc: choose and mount file system partition
|
2011-05-04 18:55:08 +00:00
|
|
|
# prereq: systype
|
2011-04-22 00:50:41 +00:00
|
|
|
|
2011-06-09 04:56:16 +00:00
|
|
|
service=cwfs
|
|
|
|
|
2011-04-22 00:50:41 +00:00
|
|
|
switch($1){
|
|
|
|
case go
|
|
|
|
echo
|
2013-03-12 21:55:00 +00:00
|
|
|
echo Please choose your $fstype partitions
|
2011-04-22 00:50:41 +00:00
|
|
|
echo
|
|
|
|
|
|
|
|
files=(`{ls /dev/sd*/fscache* /dev/fs/fscache* >[2]/dev/null})
|
2011-04-23 03:56:42 +00:00
|
|
|
if(! ~ $#files 0)
|
|
|
|
ls -l $files
|
2011-04-22 00:50:41 +00:00
|
|
|
echo
|
|
|
|
if(~ $#files 1)
|
|
|
|
default=(-d $files)
|
|
|
|
if not
|
|
|
|
default=()
|
|
|
|
prompt $default 'Cwfs cache partition' $files
|
|
|
|
fs=$rd
|
|
|
|
export fs
|
2012-08-09 18:17:51 +00:00
|
|
|
fsflags=()
|
2012-08-07 15:57:04 +00:00
|
|
|
export fsflags
|
2011-04-22 00:50:41 +00:00
|
|
|
|
|
|
|
files=(`{ls /dev/sd*/fsworm* /dev/fs/fsworm* >[2]/dev/null})
|
2011-04-23 03:56:42 +00:00
|
|
|
if(! ~ $#files 0)
|
|
|
|
ls -l $files
|
2011-04-22 00:50:41 +00:00
|
|
|
echo
|
|
|
|
if(~ $#files 1)
|
|
|
|
default=(-d $files)
|
|
|
|
if not
|
|
|
|
default=()
|
|
|
|
prompt $default 'Cwfs worm partition' $files
|
|
|
|
fsworm=$rd
|
|
|
|
export fsworm
|
|
|
|
|
|
|
|
files=(`{ls /dev/sd*/other* /dev/fs/other* >[2]/dev/null})
|
2011-04-23 03:56:42 +00:00
|
|
|
if(! ~ $#files 0)
|
|
|
|
ls -l $files
|
2011-04-22 00:50:41 +00:00
|
|
|
echo
|
|
|
|
if(~ $#files 1)
|
|
|
|
default=(-d $files)
|
|
|
|
if not
|
|
|
|
default=()
|
|
|
|
prompt $default 'Cwfs other partition' $files
|
|
|
|
fsother=$rd
|
|
|
|
export fsother
|
|
|
|
|
2011-04-28 22:38:29 +00:00
|
|
|
ream=no
|
|
|
|
if(! ~ $fstype `{fstype $fs})
|
|
|
|
ream=yes
|
|
|
|
prompt -d $ream 'Ream the filesystem?' yes no
|
|
|
|
ream=$rd
|
2011-04-22 00:50:41 +00:00
|
|
|
|
|
|
|
log Starting $fstype file server for $fs
|
|
|
|
unmount /n/newfs >[2]/dev/null
|
2011-06-09 04:56:16 +00:00
|
|
|
echo halt >>/srv/$service.cmd >[2]/dev/null
|
|
|
|
rm -f /srv/$service /srv/$service.cmd
|
2011-04-28 22:38:29 +00:00
|
|
|
|
|
|
|
if(~ $ream yes){
|
|
|
|
if(! test -f /tmp/fsconfig){
|
|
|
|
{
|
2011-06-09 04:56:16 +00:00
|
|
|
echo service $service
|
2011-04-28 22:38:29 +00:00
|
|
|
echo config $fs
|
|
|
|
|
2011-05-04 18:55:08 +00:00
|
|
|
if(! ~ $syst cpu){
|
|
|
|
# new config option
|
|
|
|
echo noauth
|
|
|
|
}
|
2011-04-28 22:38:29 +00:00
|
|
|
|
|
|
|
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'
|
2011-06-11 14:22:59 +00:00
|
|
|
if(! $fstype -f $fs -C -c </tmp/fsconfig){
|
2011-04-28 22:38:29 +00:00
|
|
|
mountfs=ready
|
|
|
|
export mountfs
|
|
|
|
exit oops
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if not {
|
|
|
|
echo 'Entering manual configuration mode. when done, type end'
|
2011-06-09 04:56:16 +00:00
|
|
|
if(! $fstype -n $service -f $fs -c){
|
2011-04-28 22:38:29 +00:00
|
|
|
mountfs=ready
|
|
|
|
export mountfs
|
|
|
|
exit oops
|
|
|
|
}
|
2011-04-22 00:50:41 +00:00
|
|
|
}
|
|
|
|
|
2012-09-17 09:45:25 +00:00
|
|
|
log Configuring $fstype file server for $fs
|
2011-04-22 00:50:41 +00:00
|
|
|
{
|
2011-06-09 04:56:16 +00:00
|
|
|
echo noattach
|
2011-04-22 00:50:41 +00:00
|
|
|
echo allow
|
|
|
|
echo users default
|
2011-04-22 01:39:00 +00:00
|
|
|
echo cfs main
|
2011-04-22 00:50:41 +00:00
|
|
|
echo create /adm adm adm 775 d
|
|
|
|
echo create /adm/users adm adm 664
|
2011-05-03 08:53:59 +00:00
|
|
|
echo create /dist sys sys 775 d
|
2011-05-04 18:55:08 +00:00
|
|
|
echo create /usr sys sys 775 d
|
2011-04-22 00:50:41 +00:00
|
|
|
echo newuser $user
|
|
|
|
echo newuser adm +$user
|
2011-05-04 18:55:08 +00:00
|
|
|
echo newuser sys +$user
|
2011-05-04 14:33:04 +00:00
|
|
|
echo newuser upas +$user
|
2011-04-22 02:40:11 +00:00
|
|
|
if(! ~ $fsother ''){
|
|
|
|
echo cfs other
|
|
|
|
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
|
|
|
|
}
|
2011-06-09 04:56:16 +00:00
|
|
|
echo noattach
|
|
|
|
sleep 2
|
|
|
|
} >>/srv/$service.cmd
|
2011-04-22 00:50:41 +00:00
|
|
|
|
|
|
|
log Mounting $fstype file server for $fs
|
2011-06-09 04:56:16 +00:00
|
|
|
while(! logprog mount -c /srv/$service /n/newfs)
|
|
|
|
sleep 2
|
2011-05-03 08:53:59 +00:00
|
|
|
if(! ~ $fsother ''){
|
|
|
|
log Mounting $fstype file server for $fsother
|
2011-06-11 14:22:59 +00:00
|
|
|
logprog mount -c /srv/$service /n/other other
|
2011-05-03 08:53:59 +00:00
|
|
|
}
|
2011-04-22 00:50:41 +00:00
|
|
|
|
|
|
|
case checkready checkdone
|
|
|
|
if(! ~ $fstype '' && ~ $#fs 1 && test -f $fs){
|
2011-06-09 04:56:16 +00:00
|
|
|
if(test -f /srv/$service && test -d /n/newfs/dist){
|
2011-04-22 00:50:41 +00:00
|
|
|
mountfs=done
|
|
|
|
export mountfs
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mountfs=ready
|
|
|
|
export mountfs
|
|
|
|
exit
|
|
|
|
}
|