diff options
Diffstat (limited to 'repos/core/initscripts')
| -rw-r--r-- | repos/core/initscripts/.checksum | 5 | ||||
| -rw-r--r-- | repos/core/initscripts/.files | 8 | ||||
| -rw-r--r-- | repos/core/initscripts/abuild | 12 | ||||
| -rw-r--r-- | repos/core/initscripts/inittab | 4 | ||||
| -rw-r--r-- | repos/core/initscripts/rc.boot | 88 | ||||
| -rw-r--r-- | repos/core/initscripts/rc.boot.local | 2 | ||||
| -rw-r--r-- | repos/core/initscripts/rc.shutdown | 27 | ||||
| -rw-r--r-- | repos/core/initscripts/rc.shutdown.local | 2 |
8 files changed, 148 insertions, 0 deletions
diff --git a/repos/core/initscripts/.checksum b/repos/core/initscripts/.checksum new file mode 100644 index 00000000..44c9b3ed --- /dev/null +++ b/repos/core/initscripts/.checksum @@ -0,0 +1,5 @@ +1ac605ef6b89575ce73faef8a7a55d8c57f4530e70ea9b45fcf0ebc02b7e4fad inittab +7121dccc36a4f025b98ca9511f8249b5f3958ad446b5846ad3f8f3d22a85ba44 rc.boot +6407df1e6c4bb27a0197cdceda085317d365c87221347599f5eb3d98684925fc rc.boot.local +cc87f21b3b0851cbbf433f31b248159adf5be61f2766d68176ad5d7814f9041b rc.shutdown +6407df1e6c4bb27a0197cdceda085317d365c87221347599f5eb3d98684925fc rc.shutdown.local diff --git a/repos/core/initscripts/.files b/repos/core/initscripts/.files new file mode 100644 index 00000000..e0e78173 --- /dev/null +++ b/repos/core/initscripts/.files @@ -0,0 +1,8 @@ +drwxr-xr-x root/root etc/ +-rw-r--r-- root/root etc/inittab.new +-rwxr-xr-x root/root etc/rc.boot.local.new +-rwxr-xr-x root/root etc/rc.boot.new +-rwxr-xr-x root/root etc/rc.shutdown.local.new +-rwxr-xr-x root/root etc/rc.shutdown.new +drwxr-xr-x root/root var/ +drwxr-xr-x root/root var/service/ diff --git a/repos/core/initscripts/abuild b/repos/core/initscripts/abuild new file mode 100644 index 00000000..5a2f4feb --- /dev/null +++ b/repos/core/initscripts/abuild @@ -0,0 +1,12 @@ +name=initscripts +version=20240726 +release=1 +source="rc.boot rc.shutdown rc.boot.local rc.shutdown.local inittab" + +build() { + mkdir -p $PKG/etc $PKG/var/service + for i in boot boot.local shutdown shutdown.local; do + install -m755 $SRC/rc.$i $PKG/etc/rc.$i + done + install -m644 $SRC/inittab $PKG/etc/inittab +} diff --git a/repos/core/initscripts/inittab b/repos/core/initscripts/inittab new file mode 100644 index 00000000..3eb7aa35 --- /dev/null +++ b/repos/core/initscripts/inittab @@ -0,0 +1,4 @@ +::sysinit:/etc/rc.boot +::respawn:/usr/bin/runsvdir /var/service +::ctrlaltdel:/sbin/reboot +::shutdown:/etc/rc.shutdown diff --git a/repos/core/initscripts/rc.boot b/repos/core/initscripts/rc.boot new file mode 100644 index 00000000..42c80ceb --- /dev/null +++ b/repos/core/initscripts/rc.boot @@ -0,0 +1,88 @@ +#!/bin/sh + +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +echo "Alice booting..." + +mountpoint -q /proc || mount -t proc proc /proc -o nosuid,noexec,nodev +mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev +mountpoint -q /run || mount -t tmpfs run /run -o mode=0755,nosuid,nodev +mountpoint -q /dev || mount -t devtmpfs dev /dev -o mode=0755,nosuid +mkdir -p /run/lock /dev/pts /dev/shm /run/runit +mountpoint -q /dev/pts || mount /dev/pts >/dev/null 2>&1 || mount -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec +mountpoint -q /dev/shm || mount /dev/shm >/dev/null 2>&1 || mount -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev + +if [ "$(command -v udevd)" ]; then + udevd --daemon + udevadm trigger --action=add --type=subsystems + udevadm trigger --action=add --type=devices + udevadm settle +else + # In the case the user may preffer mdevd as opposed to busybox mdev + if [ ! -d "/var/service/mdevd" ]; then + echo "/sbin/mdev" > /proc/sys/kernel/hotplug + mdev -s + fi + find /sys -name 'modalias' -type f -exec cat '{}' + | sort -u | xargs modprobe -b -a 2>/dev/null + ln -s /proc/self/fd /dev/fd + ln -s fd/0 /dev/stdin + ln -s fd/1 /dev/stdout + ln -s fd/2 /dev/stderr +fi + +swapon -a +ip link set lo up +mount -o remount,ro / + +for arg in $(cat /proc/cmdline); do + case $arg in + fastboot) FASTBOOT=1;; + forcefsck) FORCEFSCK="-f";; + esac +done + +if [ ! "$FASTBOOT" ]; then + fsck $FORCEFSCK -ATat noopts=_netdev + if [ "$?" -gt 1 ]; then + echo "*******************************************" + echo "** Filesystem check failed **" + echo "** You been dropped to maintenance shell **" + echo "*******************************************" + sulogin -p + fi +fi + +mount -o remount,rw / +mount -a + +if [ ! -f /etc/hostname ]; then + echo alice > /etc/hostname +fi +hostname -F /etc/hostname + +find /var/run -name "*.pid" -delete +find /tmp -xdev -mindepth 1 ! -name lost+found -delete + +if [ -f "/etc/sysctl.conf" ]; then + sysctl -q -p +fi + +hwclock -s -u + +if [ -f "/var/lib/random-seed" ]; then + cat /var/lib/random-seed >/dev/urandom + rm -f /var/lib/random-seed +fi + +if [ -d /sys/firmware/efi/efivars ]; then + mount -t efivarfs none /sys/firmware/efi/efivars +fi + +dmesg >/var/log/dmesg.log + +if [ -x /etc/rc.boot.local ]; then + /etc/rc.boot.local +fi + +IFS=. read -r boottime _ < /proc/uptime +echo "booted in ${boottime}s..." diff --git a/repos/core/initscripts/rc.boot.local b/repos/core/initscripts/rc.boot.local new file mode 100644 index 00000000..13f47935 --- /dev/null +++ b/repos/core/initscripts/rc.boot.local @@ -0,0 +1,2 @@ +#!/bin/sh + diff --git a/repos/core/initscripts/rc.shutdown b/repos/core/initscripts/rc.shutdown new file mode 100644 index 00000000..68b47022 --- /dev/null +++ b/repos/core/initscripts/rc.shutdown @@ -0,0 +1,27 @@ +#!/bin/sh + +echo "shutting down" + +if [ -x /etc/rc.shutdown.local ]; then + /etc/rc.shutdown.local +fi + +if [ "$(command -v udevadm)" ]; then + udevadm control --exit +fi + +sv down /var/service/* +dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 2>/dev/null +hwclock -w -u +kill -s TERM -1 +sleep 2 +kill -s KILL -1 +swapoff -a +ip link set lo down +umount -a -r -t noproc +mount -o remount,ro / +sync +sleep 1 +wait + +echo bye diff --git a/repos/core/initscripts/rc.shutdown.local b/repos/core/initscripts/rc.shutdown.local new file mode 100644 index 00000000..13f47935 --- /dev/null +++ b/repos/core/initscripts/rc.shutdown.local @@ -0,0 +1,2 @@ +#!/bin/sh + |