35 lines
791 B
Plaintext
Executable File
35 lines
791 B
Plaintext
Executable File
#!/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' )
|
|
|
|
spawn() {
|
|
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
|
|
|
|
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
|
|
}
|