From e2c9da41a82844c2ae5a96830e32b1f4ddf3d5b6 Mon Sep 17 00:00:00 2001 From: fbt Date: Mon, 28 Jul 2014 07:37:38 +0400 Subject: [PATCH] mounting these is the rc's job --- bin/rc | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/bin/rc b/bin/rc index bed4312..d40c622 100755 --- a/bin/rc +++ b/bin/rc @@ -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() {