Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
22bb388fdb | |||
8af7868947 | |||
e4b9660bce | |||
550fabfc8e | |||
a607a63107 | |||
782b0a3fe8 | |||
440eada379 | |||
1c91d74984 | |||
31f80cc8da | |||
f3cc18fcc2 | |||
c23f30e7ca | |||
14e07dbedf | |||
88f0fa6acb | |||
1d0bc30bb2 | |||
158c5939fd | |||
9edb1380fb | |||
f65b360295 | |||
362571f19a |
1
Makefile
1
Makefile
@@ -25,6 +25,7 @@ install: build
|
|||||||
|
|
||||||
install -m750 rc $(BINDIR)/rc
|
install -m750 rc $(BINDIR)/rc
|
||||||
install -m644 rc.conf $(ETCDIR)/rc.conf
|
install -m644 rc.conf $(ETCDIR)/rc.conf
|
||||||
|
install -m644 rc.motd $(ETCDIR)/rc.motd
|
||||||
|
|
||||||
install -m755 tools/killall5 $(BINDIR)/killall5
|
install -m755 tools/killall5 $(BINDIR)/killall5
|
||||||
|
|
||||||
|
12
rc.conf
12
rc.conf
@@ -4,14 +4,18 @@ export PATH='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
|
|||||||
# Hostname
|
# Hostname
|
||||||
cfg_hostname='changeme'
|
cfg_hostname='changeme'
|
||||||
|
|
||||||
|
# Timezone
|
||||||
|
# Change this to yours
|
||||||
|
#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' 'systemd-udevd' 'sysctl' ) # Services that need tp be started in an order
|
||||||
|
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+=( @agetty-tty{2..6} ) # Comment this if your init starts something on the ttys itself.
|
||||||
cfg_services+=( '@crond' '@network' '@dbus' '@alsa' ) # These start in parallel.
|
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.
|
|
||||||
|
|
||||||
# Modules
|
# Add modules you want to be loaded at boot time here
|
||||||
cfg_modules=( ) # Add modules you want to be loaded at boot time here
|
#cfg_modules=( )
|
||||||
|
|
||||||
# Make C-A-D perform a soft reset
|
# Make C-A-D perform a soft reset
|
||||||
ctrlaltdel soft
|
ctrlaltdel soft
|
||||||
|
38
rc.in
38
rc.in
@@ -11,23 +11,39 @@ 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; do
|
||||||
|
mkdir -v -m "${perm:-755}" "$dir"
|
||||||
|
done
|
||||||
|
|
||||||
|
printf '%s\n' "${cfg_tmpfiles[@]}" | while IFS=':' read file perm; do
|
||||||
|
> "$file"
|
||||||
|
chmod -v "${perm:-644}" "$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" || {
|
mountpoint -q "$mountpoint" || {
|
||||||
@@ -35,6 +51,7 @@ rc.mount_misc() {
|
|||||||
mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
|
mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
rc.parse_cmdline() {
|
rc.parse_cmdline() {
|
||||||
@@ -97,7 +114,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,7 +124,9 @@ rc.remount_root() {
|
|||||||
|
|
||||||
rc.boot() {
|
rc.boot() {
|
||||||
rc.mount_misc
|
rc.mount_misc
|
||||||
|
rc.tmpfiles
|
||||||
rc.hostname
|
rc.hostname
|
||||||
|
rc.timezone
|
||||||
rc.modules
|
rc.modules
|
||||||
rc.services_start
|
rc.services_start
|
||||||
wait
|
wait
|
||||||
@@ -134,6 +153,7 @@ rc.shutdown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc.hostname() {
|
rc.hostname() {
|
||||||
|
[[ -f '/etc/hostname' ]] && { hostname "$(</etc/hostname)"; }
|
||||||
[[ "$cfg_hostname" ]] && { hostname "$cfg_hostname"; }
|
[[ "$cfg_hostname" ]] && { hostname "$cfg_hostname"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +163,12 @@ rc.modules() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc.timezone() {
|
||||||
|
[[ "$cfg_timezone" ]] && {
|
||||||
|
ln -fs "/usr/share/zoneinfo/${cfg_timezone}" /etc/localtime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rc.main() {
|
rc.main() {
|
||||||
source "@ETC@/rc.conf"
|
source "@ETC@/rc.conf"
|
||||||
|
|
||||||
@@ -150,11 +176,11 @@ rc.main() {
|
|||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
boot)
|
boot)
|
||||||
echo "Welcome to `uname -rs`"
|
echo "Welcome to $(uname -rs)"
|
||||||
rc.boot
|
rc.boot
|
||||||
;;
|
;;
|
||||||
|
|
||||||
poweroff|reboot|shutdown)
|
poweroff|reboot|shutdown|halt)
|
||||||
rc.shutdown
|
rc.shutdown
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@@ -13,10 +13,6 @@ get_my_tree() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
get_realname() {
|
|
||||||
readlink -e "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
get_all_procs() {
|
get_all_procs() {
|
||||||
local processlist
|
local processlist
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user