init
This commit is contained in:
34
init.d/miscfs
Executable file
34
init.d/miscfs
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/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
|
||||
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user