From 46ca440e9d6cc606d9c3233021e32d24b25172cf Mon Sep 17 00:00:00 2001 From: emmett1 Date: Fri, 24 May 2024 12:22:12 +0800 Subject: added repos --- repos/core/initscripts/rc.boot | 87 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 repos/core/initscripts/rc.boot (limited to 'repos/core/initscripts/rc.boot') diff --git a/repos/core/initscripts/rc.boot b/repos/core/initscripts/rc.boot new file mode 100644 index 00000000..0156f293 --- /dev/null +++ b/repos/core/initscripts/rc.boot @@ -0,0 +1,87 @@ +#!/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 trigger --action=change --type=devices + udevadm settle +else + echo "/sbin/mdev" > /proc/sys/kernel/hotplug + for i in $(find /sys/devices -name 'usb[0-9]*'); do + [ -e $i/uevent ] && echo add > $i/uevent + done + mdev -s + find /sys -name 'modalias' -type f -exec cat '{}' + | sort -u | xargs modprobe -b -a 2>/dev/null + 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 linux > /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 + +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 + +for i in /etc/rc.modules /etc/rc.boot.local ; do + [ -x "$i" ] && "$i" +done -- cgit v1.2.3