ssm-services/init.d/miscfs

37 lines
836 B
Plaintext
Raw Normal View History

2013-09-28 23:32:39 +00:00
#!/usr/bin/env watchman
service_type='oneshot'
cfg_mounts+=( 'proc:proc:defaults:/proc' )
cfg_mounts+=( 'run:tmpfs:defaults:/run' )
cfg_mounts+=( 'sys:sysfs:defaults:/sys' )
start() {
for m in ${cfg_mounts[@]}; do
fs_dev=`echo "$m" | cut -d':' -f1`
fs_type=`echo "$m" | cut -d':' -f2`
fs_opts=`echo "$m" | cut -d':' -f3`
fs_mountpoint=`echo "$m" | cut -d':' -f4`
mountpoint -q "$fs_mountpoint" || {
[[ -d "$fs_mountpoint" ]] || { mkdir "$fs_mountpoint"; }
mount "$fs_dev" -n -t "$fs_type" -o "$fs_opts" "$fs_mountpoint" || {
could not mount "$fs_dev on $fs_mountpoint :("
}
}
done
2014-02-25 05:31:21 +00:00
touch "${cfg_rundir}/${service_name}.done"
2013-09-28 23:32:39 +00:00
return 0
}
stop() {
for m in "${cfg_mounts[@]}"; do
fs_mountpoint=`echo "$m" | cut -d ':' -f 4`
mountpoint -q "$fs_mountpoint" && {
umount "$fs_mountpoint"
}
done
}