From 2b32655365a577a60d0e56fd0b878f6417cbe113 Mon Sep 17 00:00:00 2001 From: fbt Date: Mon, 31 Aug 2015 01:56:54 +0300 Subject: [PATCH] Indexed arrays were only needed to override defaults. --- rc.conf | 25 ++++++++++++------------- rc.in | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/rc.conf b/rc.conf index a7384b2..802b334 100644 --- a/rc.conf +++ b/rc.conf @@ -14,25 +14,24 @@ cfg_services+=( '@lo.iface' '@scron' ) -# Add modules you want to be loaded at boot time here +# Uncomment and add modules you want to be loaded at boot time here #cfg_modules=( ) # Make C-A-D perform a soft reset ctrlaltdel soft -# Default virtual mounts for linux systems -cfg_mounts[proc]='proc:/proc' -cfg_mounts[run]='tmpfs:/run' -cfg_mounts[sys]='sysfs:/sys' +# Virtual filesystems +cfg_mounts=( + 'proc:proc:/proc' + 'run:tmpfs:/run' + 'sys:sysfs:/sys' -# devfs and its children -cfg_mounts[dev]='devtmpfs:/dev' -cfg_mounts[pts]='devpts:/dev/pts:noexec,nosuid,gid=5,mode=0620' -cfg_mounts[mqueue]='mqueue:/dev/mqueue:noexec,nosuid,nodev' -cfg_mounts[shm]='tmpfs:/dev/shm:defaults,mode=0777' + 'dev:devtmpfs:/dev' + 'pts:devpts:/dev/pts:noexec,nosuid,gid=5,mode=0620' + 'mqueue:mqueue:/dev/mqueue:noexec,nosuid,nodev' + 'shm:tmpfs:/dev/shm:defaults,mode=0777' +) -# Some temporary directories +# Some temporary directories and files cfg_tmpdirs+=( '/run/lock' '/run/lock/lvm' '/run/lvm' '/run/user' ) - -# And temporary files cfg_tmpfiles+=( '/run/utmp' ) diff --git a/rc.in b/rc.in index f3c32a9..6a5d093 100644 --- a/rc.in +++ b/rc.in @@ -26,16 +26,16 @@ rc.tmpfiles() { done } -rc.mount_misc() { - for fs in "${!cfg_mounts[@]}"; do - echo "${cfg_mounts[$fs]}" | while IFS=':' read fs_type mountpoint mount_options; do - [[ "$mount_options" ]] || { mount_options='defaults'; } +rc.mount() { + for fs in "${cfg_mounts[@]}"; do + echo "$fs" | while IFS=':' read device fs_type mountpoint mount_options - mountpoint -q "$mountpoint" || { - [[ -d "$mountpoint" ]] || { mkdir -p "$mountpoint"; } - mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint" - } - done + [[ "$mount_options" ]] || { mount_options='defaults'; } + + mountpoint -q "$mountpoint" || { + [[ -d "$mountpoint" ]] || { mkdir -p "$mountpoint"; } + mount "$device" -n -t "$fs_type" -o "$mount_options" "$mountpoint" + } done } @@ -108,7 +108,7 @@ rc.remount_root() { } rc.boot() { - rc.mount_misc + rc.mount rc.tmpfiles rc.hostname rc.timezone