Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 -m644 rc.conf $(ETCDIR)/rc.conf
|
||||
install -m644 rc.motd $(ETCDIR)/rc.motd
|
||||
|
||||
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
|
||||
cfg_hostname='changeme'
|
||||
|
||||
# Timezone
|
||||
# Change this to yours
|
||||
#cfg_timezone='Europe/Moscow'
|
||||
|
||||
# Services
|
||||
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+=( '@crond' '@network' '@dbus' '@alsa' ) # These start in parallel.
|
||||
cfg_services+=( 'rc.local' ) # Traditionally, rc.local starts last.
|
||||
cfg_services+=( 'rc.local' ) # Traditionally, rc.local starts last. Technically here it doesn't. Not quite :)
|
||||
|
||||
# Modules
|
||||
cfg_modules=( ) # Add modules you want to be loaded at boot time here
|
||||
# Add modules you want to be loaded at boot time here
|
||||
#cfg_modules=( )
|
||||
|
||||
# Make C-A-D perform a soft reset
|
||||
ctrlaltdel soft
|
||||
|
41
rc.in
41
rc.in
@@ -11,29 +11,36 @@ 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' )
|
||||
|
||||
# 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.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'; }
|
||||
|
||||
[[ "$mount_options" ]] || { mount_options='defaults'; }
|
||||
|
||||
mountpoint -q "$mountpoint" || {
|
||||
[[ -d "$mountpoint" ]] || { mkdir -p "$mountpoint"; }
|
||||
mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
|
||||
}
|
||||
mountpoint -q "$mountpoint" || {
|
||||
[[ -d "$mountpoint" ]] || { mkdir -p "$mountpoint"; }
|
||||
mount "$fs" -n -t "$fs_type" -o "$mount_options" "$mountpoint"
|
||||
}
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
@@ -107,7 +114,10 @@ rc.remount_root() {
|
||||
|
||||
rc.boot() {
|
||||
rc.mount_misc
|
||||
rc.tmpdirs
|
||||
rc.tmpfiles
|
||||
rc.hostname
|
||||
rc.timezone
|
||||
rc.modules
|
||||
rc.services_start
|
||||
wait
|
||||
@@ -134,6 +144,7 @@ rc.shutdown() {
|
||||
}
|
||||
|
||||
rc.hostname() {
|
||||
[[ -f '/etc/hostname' ]] && { hostname "$(</etc/hostname)"; }
|
||||
[[ "$cfg_hostname" ]] && { hostname "$cfg_hostname"; }
|
||||
}
|
||||
|
||||
@@ -143,6 +154,16 @@ rc.modules() {
|
||||
done
|
||||
}
|
||||
|
||||
rc.timezone() {
|
||||
[[ "$cfg_timezone" ]] && {
|
||||
ln -fs "/usr/share/zoneinfo/${cfg_timezone}" /etc/localtime
|
||||
}
|
||||
}
|
||||
|
||||
rc.tmpfiles() {
|
||||
>/run/utmp
|
||||
}
|
||||
|
||||
rc.main() {
|
||||
source "@ETC@/rc.conf"
|
||||
|
||||
@@ -150,11 +171,11 @@ rc.main() {
|
||||
|
||||
case "$action" in
|
||||
boot)
|
||||
echo "Welcome to `uname -rs`"
|
||||
echo "Welcome to $(uname -rs)"
|
||||
rc.boot
|
||||
;;
|
||||
|
||||
poweroff|reboot|shutdown)
|
||||
poweroff|reboot|shutdown|halt)
|
||||
rc.shutdown
|
||||
;;
|
||||
esac
|
||||
|
@@ -13,10 +13,6 @@ get_my_tree() {
|
||||
done
|
||||
}
|
||||
|
||||
get_realname() {
|
||||
readlink -e "$1"
|
||||
}
|
||||
|
||||
get_all_procs() {
|
||||
local processlist
|
||||
|
||||
|
Reference in New Issue
Block a user