aboutsummaryrefslogtreecommitdiff
path: root/initscripts
diff options
context:
space:
mode:
authorWoodpecker CI <emmett1.2miligrams@protonmail.com>2025-06-03 14:32:34 +0000
committerWoodpecker CI <emmett1.2miligrams@protonmail.com>2025-06-03 14:32:34 +0000
commit8df1d35909ec2d57a6845f5b2c26ee1e83cfd032 (patch)
tree88e5aaa8cf9d3c0538cdff935a56786705548d75 /initscripts
parent96ec28ea0d2c05032f40f50bc6b9de7020138f57 (diff)
downloadalicelinux-8df1d35909ec2d57a6845f5b2c26ee1e83cfd032.tar.gz
alicelinux-8df1d35909ec2d57a6845f5b2c26ee1e83cfd032.zip
Woodpecker CI 5171f1fdd74e7137c305450dd69a29fa5be4143f [SKIP CI]
Diffstat (limited to 'initscripts')
-rw-r--r--initscripts/.checksum5
-rw-r--r--initscripts/.files8
-rw-r--r--initscripts/abuild12
-rw-r--r--initscripts/inittab4
-rw-r--r--initscripts/rc.boot88
-rw-r--r--initscripts/rc.boot.local2
-rw-r--r--initscripts/rc.shutdown27
-rw-r--r--initscripts/rc.shutdown.local2
8 files changed, 148 insertions, 0 deletions
diff --git a/initscripts/.checksum b/initscripts/.checksum
new file mode 100644
index 00000000..44c9b3ed
--- /dev/null
+++ b/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/initscripts/.files b/initscripts/.files
new file mode 100644
index 00000000..e0e78173
--- /dev/null
+++ b/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/initscripts/abuild b/initscripts/abuild
new file mode 100644
index 00000000..5a2f4feb
--- /dev/null
+++ b/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/initscripts/inittab b/initscripts/inittab
new file mode 100644
index 00000000..3eb7aa35
--- /dev/null
+++ b/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/initscripts/rc.boot b/initscripts/rc.boot
new file mode 100644
index 00000000..42c80ceb
--- /dev/null
+++ b/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/initscripts/rc.boot.local b/initscripts/rc.boot.local
new file mode 100644
index 00000000..13f47935
--- /dev/null
+++ b/initscripts/rc.boot.local
@@ -0,0 +1,2 @@
+#!/bin/sh
+
diff --git a/initscripts/rc.shutdown b/initscripts/rc.shutdown
new file mode 100644
index 00000000..68b47022
--- /dev/null
+++ b/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/initscripts/rc.shutdown.local b/initscripts/rc.shutdown.local
new file mode 100644
index 00000000..13f47935
--- /dev/null
+++ b/initscripts/rc.shutdown.local
@@ -0,0 +1,2 @@
+#!/bin/sh
+