Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
79bccd989e | |||
6d2a516b64 | |||
|
87de61f78c | ||
22bb388fdb | |||
8af7868947 | |||
e4b9660bce | |||
550fabfc8e | |||
a607a63107 | |||
782b0a3fe8 | |||
440eada379 | |||
1c91d74984 | |||
31f80cc8da |
2
rc.conf
2
rc.conf
@@ -10,7 +10,7 @@ cfg_hostname='changeme'
|
||||
|
||||
# Services
|
||||
cfg_services+=( 'fsck' 'mount' 'systemd-udevd' 'sysctl' ) # Services that need tp be started in an order
|
||||
cfg_services+=( '@lo.iface' '@crond' '@dbus' '@alsa' ) # These start in parallel.
|
||||
cfg_services+=( '@lo.iface' ) # These start in parallel.
|
||||
cfg_services+=( @agetty-tty{2..6} ) # Comment this if your init starts something on the ttys itself.
|
||||
cfg_services+=( 'rc.local' ) # Traditionally, rc.local starts last. Technically here it doesn't. Not quite :)
|
||||
|
||||
|
29
rc.in
29
rc.in
@@ -14,27 +14,37 @@ 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' )
|
||||
|
||||
# Functions
|
||||
rc.rescue() { exec "${cfg_rc_rescue_shell:-"$SHELL"}"; }
|
||||
|
||||
rc.motd() {
|
||||
[[ -f "/etc/rc.motd" ]] && {
|
||||
while read; do
|
||||
printf "$REPLY"
|
||||
printf "%s\n" "$REPLY"
|
||||
done < "/etc/rc.motd"
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
rc.tmpdirs() {
|
||||
mkdir -p -m0755 "${cfg_tmpdirs[@]}"
|
||||
rc.tmpfiles() {
|
||||
printf '%s\n' "${cfg_tmpdirs[@]}" | while IFS=':' read dir perm own grp; do
|
||||
install -v -d -m "${perm:-755}" -o "${own:-root}" -g "${grp:-root}" "$dir" 2>/dev/null
|
||||
done
|
||||
|
||||
printf '%s\n' "${cfg_tmpfiles[@]}" | while IFS=':' read file perm own grp; do
|
||||
> "$file"
|
||||
chmod -c "${perm:-644}" "$file"
|
||||
chown -c "${own:-root}:${grp:-root}" "$file"
|
||||
done
|
||||
}
|
||||
|
||||
rc.mount_misc() {
|
||||
for m in "${cfg_mounts[@]}"; do
|
||||
IFS=':' read fs fs_type mountpoint mount_options <<< "$m"
|
||||
|
||||
echo "$m" | while IFS=':' read fs fs_type mountpoint mount_options; do
|
||||
[[ "$mount_options" ]] || { mount_options='defaults'; }
|
||||
|
||||
mountpoint -q "$mountpoint" || {
|
||||
@@ -42,6 +52,7 @@ rc.mount_misc() {
|
||||
mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
|
||||
}
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
rc.parse_cmdline() {
|
||||
@@ -104,7 +115,7 @@ rc.stop_everything() {
|
||||
|
||||
rc.unmount_everything() {
|
||||
echo "Unmounting filesystems..."
|
||||
umount -a
|
||||
umount -r -a
|
||||
}
|
||||
|
||||
rc.remount_root() {
|
||||
@@ -114,7 +125,7 @@ rc.remount_root() {
|
||||
|
||||
rc.boot() {
|
||||
rc.mount_misc
|
||||
rc.tmpdirs
|
||||
rc.tmpfiles
|
||||
rc.hostname
|
||||
rc.timezone
|
||||
rc.modules
|
||||
@@ -134,6 +145,7 @@ rc.halt() {
|
||||
rc.shutdown() {
|
||||
rc.services_stop
|
||||
rc.stop_everything
|
||||
sync
|
||||
rc.unmount_everything
|
||||
rc.remount_root
|
||||
|
||||
@@ -143,6 +155,7 @@ rc.shutdown() {
|
||||
}
|
||||
|
||||
rc.hostname() {
|
||||
[[ -f '/etc/hostname' ]] && { hostname "$(</etc/hostname)"; }
|
||||
[[ "$cfg_hostname" ]] && { hostname "$cfg_hostname"; }
|
||||
}
|
||||
|
||||
@@ -165,7 +178,7 @@ rc.main() {
|
||||
|
||||
case "$action" in
|
||||
boot)
|
||||
echo "Welcome to `uname -rs`"
|
||||
echo "Welcome to $(uname -rs)"
|
||||
rc.boot
|
||||
;;
|
||||
|
||||
|
Reference in New Issue
Block a user