diff options
| author | Shokara Kou <kou@13f0.net> | 2022-05-13 11:50:43 -0400 |
|---|---|---|
| committer | Shokara Kou <kou@13f0.net> | 2022-12-10 16:12:53 -0500 |
| commit | f9b84b4967282cd6da931b7ea2569557937d4e24 (patch) | |
| tree | 07f690d9180ce73379adc9182af49e72f259dbcd /sinit/rc.init | |
| parent | 81255a3b68be5969bf107bcb46e75a11187c2f53 (diff) | |
add sinit and perp
replaces sysvinit. perp can be used alongside crux's rc scripts, but i
didn't try that.
Diffstat (limited to 'sinit/rc.init')
| -rw-r--r-- | sinit/rc.init | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/sinit/rc.init b/sinit/rc.init new file mode 100644 index 0000000..aab0073 --- /dev/null +++ b/sinit/rc.init | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | umask 022 | ||
| 3 | |||
| 4 | . /etc/rc.conf | ||
| 5 | |||
| 6 | echo "CRUX booting" | ||
| 7 | |||
| 8 | /bin/mount -n -t proc -o nosuid,noexec,nodev proc /proc | ||
| 9 | /bin/mount -n -t sysfs -o nosuid,noexec,nodev sysfs /sys | ||
| 10 | |||
| 11 | /bin/mount -n -t tmpfs -o nosuid,mode=0755 dev /dev | ||
| 12 | /bin/mkdir -p /dev/pts | ||
| 13 | /bin/mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts | ||
| 14 | |||
| 15 | /bin/mount -o remount,ro / | ||
| 16 | |||
| 17 | echo Running smdev | ||
| 18 | /bin/smdev -s | ||
| 19 | |||
| 20 | echo Setting smdev as the kernel hotplug | ||
| 21 | echo /bin/smdev >/proc/sys/kernel/hotplug | ||
| 22 | |||
| 23 | cd /dev | ||
| 24 | /bin/ln -sf /proc/self/fd/0 stdin | ||
| 25 | /bin/ln -sf /proc/self/fd/1 stdout | ||
| 26 | /bin/ln -sf /proc/self/fd/2 stderr | ||
| 27 | /bin/ln -sf /proc/self/fd fd | ||
| 28 | cd - >/dev/null | ||
| 29 | |||
| 30 | echo Checking filesystems | ||
| 31 | /bin/fsck -ATa | ||
| 32 | if [ $? -eq 1 ]; then | ||
| 33 | echo Filesystems error exist, fix manually. | ||
| 34 | /bin/sh | ||
| 35 | /bin/halt -r | ||
| 36 | fi | ||
| 37 | |||
| 38 | echo Remounting root as read-write | ||
| 39 | /bin/mount -o remount,rw / | ||
| 40 | |||
| 41 | echo Mounting filesystems | ||
| 42 | /bin/mount -a | ||
| 43 | |||
| 44 | /bin/hostname $HOSTNAME | ||
| 45 | |||
| 46 | echo Bringing up loopback | ||
| 47 | /bin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host | ||
| 48 | /bin/ip link set lo up | ||
| 49 | |||
| 50 | echo Setting hwclock | ||
| 51 | [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE" | ||
| 52 | /bin/hwclock -s -u /dev/rtc0 | ||
| 53 | unset TZ | ||
| 54 | |||
| 55 | [ -f /etc/random-seed ] && /bin/cat /etc/random-seed >/dev/urandom | ||
| 56 | /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null | ||
| 57 | |||
| 58 | echo Enabling core dumps | ||
| 59 | ulimit -c unlimited | ||
| 60 | |||
| 61 | if [ -x /etc/rc.local ]; then | ||
| 62 | echo Running rc.local | ||
| 63 | /etc/rc.local | ||
| 64 | fi | ||
| 65 | |||
| 66 | : >/var/run/utmp | ||
| 67 | |||
| 68 | echo | ||
| 69 | /bin/sh -c '/bin/respawn /bin/getty /dev/tty1 linux' &>/dev/null & | ||
| 70 | /bin/sh -c '/bin/respawn /bin/getty /dev/tty2 linux' &>/dev/null & | ||
| 71 | /bin/sh -c '/bin/respawn /bin/getty /dev/tty3 linux' &>/dev/null & | ||
| 72 | /bin/sh -c '/bin/respawn /bin/getty /dev/tty4 linux' &>/dev/null & | ||
