mounting these is the rc's job

This commit is contained in:
Jack L. Frost 2014-07-28 07:37:38 +04:00
parent 0b8f15ee5e
commit e2c9da41a8
1 changed files with 13 additions and 16 deletions

29
bin/rc
View File

@ -1,5 +1,11 @@
#!/bin/bash
# Default virtual mounts for linux systems
cfg_mounts+=( 'proc:proc:/proc:' )
cfg_mounts+=( 'run:tmpfs:/run:' )
cfg_mounts+=( 'sys:sysfs:/sys:' )
cfg_mounts+=( 'dev:devtmpfs:/dev:' )
# Functions
rc.rescue() { exec "${cfg_rc_rescue_shell:-"$SHELL"}"; }
@ -13,23 +19,14 @@ rc.motd() {
return 0
}
rc.mount() {
local fs
local fs_type
local mountpoint
local mount_options
fs="$1"
fs_type="$2"
mountpoint="$3"
mount_options="${4:-defaults}"
mount "$1" -n -t "$2" -o "$mount_options" "$3"
}
rc.mount_misc() {
mountpoint -q /proc || { rc.mount proc proc /proc; }
mountpoint -q /dev || { rc.mount dev devtmpfs /dev; }
for m in "${cfg_mounts[@]}"; do
IFS=':' read fs fs_type mountpoint mount_options <<< "$m"
[[ "$mount_options" ]] || { mount_options='defaults' }
mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
done
}
rc.parse_cmdline() {