Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
33cea83d1b | |||
79bccd989e | |||
6d2a516b64 | |||
|
87de61f78c | ||
22bb388fdb | |||
8af7868947 | |||
e4b9660bce | |||
550fabfc8e | |||
a607a63107 | |||
782b0a3fe8 | |||
440eada379 | |||
1c91d74984 | |||
31f80cc8da | |||
f3cc18fcc2 | |||
c23f30e7ca |
4
rc.conf
4
rc.conf
@@ -9,8 +9,8 @@ cfg_hostname='changeme'
|
|||||||
#cfg_timezone='Europe/Moscow'
|
#cfg_timezone='Europe/Moscow'
|
||||||
|
|
||||||
# Services
|
# Services
|
||||||
cfg_services+=( 'fsck' 'mount' 'systemd-udevd' 'sysctl' ) # Services that need tp be started in an order
|
cfg_services+=( 'fsck' 'mount' 'sysctl' 'rsyslogd' ) # Services that need tp be started in an order
|
||||||
cfg_services+=( '@lo.iface' '@crond' '@dbus' '@alsa' ) # These start in parallel.
|
cfg_services+=( '@lo.iface' '@scron' '@sshd' ) # These start in parallel.
|
||||||
cfg_services+=( @agetty-tty{2..6} ) # Comment this if your init starts something on the ttys itself.
|
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 :)
|
cfg_services+=( 'rc.local' ) # Traditionally, rc.local starts last. Technically here it doesn't. Not quite :)
|
||||||
|
|
||||||
|
45
rc.in
45
rc.in
@@ -11,29 +11,47 @@ cfg_mounts+=( 'pts:devpts:/dev/pts:noexec,nosuid,gid=5,mode=0620' )
|
|||||||
cfg_mounts+=( 'mqueue:mqueue:/dev/mqueue:noexec,nosuid,nodev' )
|
cfg_mounts+=( 'mqueue:mqueue:/dev/mqueue:noexec,nosuid,nodev' )
|
||||||
cfg_mounts+=( 'shm:tmpfs:/dev/shm:defaults,mode=0777' )
|
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
|
# Functions
|
||||||
rc.rescue() { exec "${cfg_rc_rescue_shell:-"$SHELL"}"; }
|
rc.rescue() { exec "${cfg_rc_rescue_shell:-"$SHELL"}"; }
|
||||||
|
|
||||||
rc.motd() {
|
rc.motd() {
|
||||||
[[ -f "/etc/rc.motd" ]] && {
|
[[ -f "/etc/rc.motd" ]] && {
|
||||||
while read; do
|
while read; do
|
||||||
printf "$REPLY"
|
printf "%s\n" "$REPLY"
|
||||||
done < "/etc/rc.motd"
|
done < "/etc/rc.motd"
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() {
|
rc.mount_misc() {
|
||||||
for m in "${cfg_mounts[@]}"; do
|
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'; }
|
||||||
|
|
||||||
[[ "$mount_options" ]] || { mount_options='defaults'; }
|
mountpoint -q "$mountpoint" || {
|
||||||
|
[[ -d "$mountpoint" ]] || { mkdir -p "$mountpoint"; }
|
||||||
mountpoint -q "$mountpoint" || {
|
mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
|
||||||
[[ -d "$mountpoint" ]] || { mkdir -p "$mountpoint"; }
|
}
|
||||||
mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
|
done
|
||||||
}
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +115,7 @@ rc.stop_everything() {
|
|||||||
|
|
||||||
rc.unmount_everything() {
|
rc.unmount_everything() {
|
||||||
echo "Unmounting filesystems..."
|
echo "Unmounting filesystems..."
|
||||||
umount -a
|
umount -r -a
|
||||||
}
|
}
|
||||||
|
|
||||||
rc.remount_root() {
|
rc.remount_root() {
|
||||||
@@ -107,6 +125,7 @@ rc.remount_root() {
|
|||||||
|
|
||||||
rc.boot() {
|
rc.boot() {
|
||||||
rc.mount_misc
|
rc.mount_misc
|
||||||
|
rc.tmpfiles
|
||||||
rc.hostname
|
rc.hostname
|
||||||
rc.timezone
|
rc.timezone
|
||||||
rc.modules
|
rc.modules
|
||||||
@@ -123,9 +142,14 @@ rc.halt() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc.sync() {
|
||||||
|
echo "Syncing disks."
|
||||||
|
}
|
||||||
|
|
||||||
rc.shutdown() {
|
rc.shutdown() {
|
||||||
rc.services_stop
|
rc.services_stop
|
||||||
rc.stop_everything
|
rc.stop_everything
|
||||||
|
rc.sync
|
||||||
rc.unmount_everything
|
rc.unmount_everything
|
||||||
rc.remount_root
|
rc.remount_root
|
||||||
|
|
||||||
@@ -135,6 +159,7 @@ rc.shutdown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc.hostname() {
|
rc.hostname() {
|
||||||
|
[[ -f '/etc/hostname' ]] && { hostname "$(</etc/hostname)"; }
|
||||||
[[ "$cfg_hostname" ]] && { hostname "$cfg_hostname"; }
|
[[ "$cfg_hostname" ]] && { hostname "$cfg_hostname"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +182,7 @@ rc.main() {
|
|||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
boot)
|
boot)
|
||||||
echo "Welcome to `uname -rs`"
|
echo "Welcome to $(uname -rs)"
|
||||||
rc.boot
|
rc.boot
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user