Indexed arrays were only needed to override defaults.

This commit is contained in:
Jack L. Frost 2015-08-31 01:56:54 +03:00
parent ec2ff428f8
commit 2b32655365
2 changed files with 22 additions and 23 deletions

25
rc.conf
View File

@ -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' )

20
rc.in
View File

@ -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