Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
63eda033cc | |||
2b32655365 | |||
ec2ff428f8 |
34
rc.conf
34
rc.conf
@@ -1,21 +1,37 @@
|
|||||||
# System-wide configuration
|
# System-wide configuration
|
||||||
export PATH='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
|
export PATH='/usr/local/bin:/usr/local/sbin:/usr/bin'
|
||||||
|
|
||||||
# Hostname
|
# Hostname
|
||||||
cfg_hostname='changeme'
|
cfg_hostname='spark'
|
||||||
|
|
||||||
# Timezone
|
# Timezone
|
||||||
# Change this to yours
|
# Uncomment and change this to yours
|
||||||
#cfg_timezone='Europe/Moscow'
|
#cfg_timezone='Europe/Moscow'
|
||||||
|
|
||||||
# Services
|
# Services that start with @ are executed in parallel
|
||||||
cfg_services+=( 'fsck' 'mount' 'sysctl' 'rsyslogd' ) # Services that need tp be started in an order
|
cfg_services+=(
|
||||||
cfg_services+=( '@lo.iface' '@scron' '@sshd' ) # These start in parallel.
|
'fsck' 'mount' 'sysctl' 'rsyslogd'
|
||||||
cfg_services+=( @agetty-tty{2..6} ) # Comment this if your init starts something on the ttys itself.
|
'@lo.iface' '@scron'
|
||||||
cfg_services+=( 'rc.local' ) # Traditionally, rc.local starts last. Technically here it doesn't. Not quite :)
|
)
|
||||||
|
|
||||||
# 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=( )
|
#cfg_modules=( )
|
||||||
|
|
||||||
# Make C-A-D perform a soft reset
|
# Make C-A-D perform a soft reset
|
||||||
ctrlaltdel soft
|
ctrlaltdel soft
|
||||||
|
|
||||||
|
# Virtual filesystems
|
||||||
|
cfg_mounts=(
|
||||||
|
'proc:proc:/proc'
|
||||||
|
'run:tmpfs:/run'
|
||||||
|
'sys:sysfs:/sys'
|
||||||
|
|
||||||
|
'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 and files
|
||||||
|
cfg_tmpdirs+=( '/run/lock' '/run/lock/lvm' '/run/lvm' '/run/user' )
|
||||||
|
cfg_tmpfiles+=( '/run/utmp' )
|
||||||
|
45
rc.in
45
rc.in
@@ -1,30 +1,4 @@
|
|||||||
#!@BASH_PATH@
|
#!@BASH_PATH@
|
||||||
declare -A cfg_mounts
|
|
||||||
|
|
||||||
# Default virtual mounts for linux systems
|
|
||||||
cfg_mounts[proc]='proc:/proc'
|
|
||||||
cfg_mounts[run]='tmpfs:/run'
|
|
||||||
cfg_mounts[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'
|
|
||||||
|
|
||||||
# Some temporary directories
|
|
||||||
cfg_tmpdirs+=( '/run/lock' '/run/lock/lvm' '/run/lvm' '/run/user' )
|
|
||||||
|
|
||||||
# And temporary files
|
|
||||||
cfg_tmpfiles+=( '/run/utmp' )
|
|
||||||
|
|
||||||
# Default XDG_RUNTIME_DIR for all non-system users
|
|
||||||
# rtkit:x:133:133:RealtimeKit:/proc:/sbin/nologin
|
|
||||||
while IFS=':' read -r _ _ uid gid _; do
|
|
||||||
if (( uid >= 1000 )); then
|
|
||||||
cfg_tmpdirs+=( "/run/user/$uid:700:$uid:$gid" )
|
|
||||||
fi
|
|
||||||
done < /etc/passwd
|
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
rc.rescue() { exec "${cfg_rc_rescue_shell:-"$SHELL"}"; }
|
rc.rescue() { exec "${cfg_rc_rescue_shell:-"$SHELL"}"; }
|
||||||
@@ -52,14 +26,15 @@ rc.tmpfiles() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
rc.mount_misc() {
|
rc.mount() {
|
||||||
for fs in "${!cfg_mounts[@]}"; do
|
for fs in "${cfg_mounts[@]}"; do
|
||||||
echo "${cfg_mounts[$fs]}" | while IFS=':' read fs_type mountpoint mount_options; do
|
echo "$fs" | while IFS=':' read device fs_type mountpoint mount_options; do
|
||||||
|
|
||||||
[[ "$mount_options" ]] || { mount_options='defaults'; }
|
[[ "$mount_options" ]] || { mount_options='defaults'; }
|
||||||
|
|
||||||
mountpoint -q "$mountpoint" || {
|
mountpoint -q "$mountpoint" || {
|
||||||
[[ -d "$mountpoint" ]] || { mkdir -p "$mountpoint"; }
|
[[ -d "$mountpoint" ]] || { mkdir -p "$mountpoint"; }
|
||||||
mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
|
mount "$device" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@@ -134,7 +109,7 @@ rc.remount_root() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc.boot() {
|
rc.boot() {
|
||||||
rc.mount_misc
|
rc.mount
|
||||||
rc.tmpfiles
|
rc.tmpfiles
|
||||||
rc.hostname
|
rc.hostname
|
||||||
rc.timezone
|
rc.timezone
|
||||||
@@ -188,6 +163,14 @@ rc.timezone() {
|
|||||||
rc.main() {
|
rc.main() {
|
||||||
source "@ETC@/rc.conf"
|
source "@ETC@/rc.conf"
|
||||||
|
|
||||||
|
# Default XDG_RUNTIME_DIR for all non-system users
|
||||||
|
# rtkit:x:133:133:RealtimeKit:/proc:/sbin/nologin
|
||||||
|
while IFS=':' read -r _ _ uid gid _; do
|
||||||
|
if (( uid >= 1000 )); then
|
||||||
|
cfg_tmpdirs+=( "/run/user/$uid:700:$uid:$gid" )
|
||||||
|
fi
|
||||||
|
done < /etc/passwd
|
||||||
|
|
||||||
action="${1:-boot}"
|
action="${1:-boot}"
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
|
Reference in New Issue
Block a user