diff --git a/srcpkgs/dinit/INSTALL b/srcpkgs/dinit/INSTALL new file mode 100644 index 0000000..91c7508 --- /dev/null +++ b/srcpkgs/dinit/INSTALL @@ -0,0 +1,4 @@ +case "$ACTION" in +post) + drunner +esac diff --git a/srcpkgs/dinit/files/dinit.d/boot b/srcpkgs/dinit/files/dinit.d/boot new file mode 100644 index 0000000..f5372f4 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot @@ -0,0 +1,2 @@ +type = internal +waits-for.d = boot.d diff --git a/srcpkgs/dinit/files/dinit.d/boot.d/drunner b/srcpkgs/dinit/files/dinit.d/boot.d/drunner new file mode 120000 index 0000000..4d11745 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot.d/drunner @@ -0,0 +1 @@ +../drunner \ No newline at end of file diff --git a/srcpkgs/dinit/files/dinit.d/boot.d/early-filesystems b/srcpkgs/dinit/files/dinit.d/boot.d/early-filesystems new file mode 120000 index 0000000..af8aa56 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot.d/early-filesystems @@ -0,0 +1 @@ +../early-filesystems \ No newline at end of file diff --git a/srcpkgs/dinit/files/dinit.d/boot.d/hostname b/srcpkgs/dinit/files/dinit.d/boot.d/hostname new file mode 120000 index 0000000..57f501e --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot.d/hostname @@ -0,0 +1 @@ +../hostname \ No newline at end of file diff --git a/srcpkgs/dinit/files/dinit.d/boot.d/hwclock b/srcpkgs/dinit/files/dinit.d/boot.d/hwclock new file mode 120000 index 0000000..b47ce63 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot.d/hwclock @@ -0,0 +1 @@ +../hwclock \ No newline at end of file diff --git a/srcpkgs/dinit/files/dinit.d/boot.d/rcboot b/srcpkgs/dinit/files/dinit.d/boot.d/rcboot new file mode 120000 index 0000000..d2ea789 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot.d/rcboot @@ -0,0 +1 @@ +../rcboot \ No newline at end of file diff --git a/srcpkgs/dinit/files/dinit.d/boot.d/rootfscheck b/srcpkgs/dinit/files/dinit.d/boot.d/rootfscheck new file mode 120000 index 0000000..43ea058 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot.d/rootfscheck @@ -0,0 +1 @@ +../rootfscheck \ No newline at end of file diff --git a/srcpkgs/dinit/files/dinit.d/boot.d/rootrw b/srcpkgs/dinit/files/dinit.d/boot.d/rootrw new file mode 120000 index 0000000..56d7650 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot.d/rootrw @@ -0,0 +1 @@ +../rootrw \ No newline at end of file diff --git a/srcpkgs/dinit/files/dinit.d/boot.d/udev-settle b/srcpkgs/dinit/files/dinit.d/boot.d/udev-settle new file mode 120000 index 0000000..4f770f9 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot.d/udev-settle @@ -0,0 +1 @@ +../udev-settle \ No newline at end of file diff --git a/srcpkgs/dinit/files/dinit.d/boot.d/udev-trigger b/srcpkgs/dinit/files/dinit.d/boot.d/udev-trigger new file mode 120000 index 0000000..9858fbf --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/boot.d/udev-trigger @@ -0,0 +1 @@ +../udev-trigger \ No newline at end of file diff --git a/srcpkgs/dinit/files/dinit.d/drunner b/srcpkgs/dinit/files/dinit.d/drunner new file mode 100644 index 0000000..2c5c8c6 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/drunner @@ -0,0 +1,6 @@ +# Translate runit services + +type = scripted +command = /bin/drunner +restart = false + diff --git a/srcpkgs/dinit/files/dinit.d/early-filesystems b/srcpkgs/dinit/files/dinit.d/early-filesystems new file mode 100644 index 0000000..edc3ad8 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/early-filesystems @@ -0,0 +1,6 @@ +# Early (virtual) filesystems - /proc, /sys, etc + +type = scripted +command = /etc/dinit.d/early-filesystems.sh start +restart = false +options = starts-rwfs diff --git a/srcpkgs/dinit/files/dinit.d/early-filesystems.sh b/srcpkgs/dinit/files/dinit.d/early-filesystems.sh new file mode 100755 index 0000000..08186f1 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/early-filesystems.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +if [ "$1" = start ]; then + + PATH=/usr/bin:/usr/sbin:/bin:/sbin + + mkdir -p /dev/pts /dev/shm + mount -n -t tmpfs -o nodev,nosuid tmpfs /dev/shm + mount -n -t devpts -o gid=5 devpts /dev/pts + + # /run, and various directories within it + mount -n -t tmpfs -o mode=775 tmpfs /run + mkdir /run/lock /run/udev + +fi diff --git a/srcpkgs/dinit/files/dinit.d/hostname b/srcpkgs/dinit/files/dinit.d/hostname new file mode 100644 index 0000000..76504fe --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/hostname @@ -0,0 +1,5 @@ +# Set the hostname + +type = scripted +command = /bin/hostname -F /etc/hostname +restart = false diff --git a/srcpkgs/dinit/files/dinit.d/hwclock b/srcpkgs/dinit/files/dinit.d/hwclock new file mode 100644 index 0000000..7feaa1b --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/hwclock @@ -0,0 +1,12 @@ +# Set system time from hardware clock + +type = scripted +logfile = /run/hwclock.log +command = /sbin/hwclock --hctosys + +# Optional, not necessary, and not recommended: +#stop-command = /sbin/hwclock --systohc + +restart = false + +depends-on = udevd diff --git a/srcpkgs/dinit/files/dinit.d/rcboot b/srcpkgs/dinit/files/dinit.d/rcboot new file mode 100644 index 0000000..97bafe4 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/rcboot @@ -0,0 +1,7 @@ +# Various startup operations + +type = scripted +command = /etc/dinit.d/rcboot.sh start +stop-command = /etc/dinit.d/rcboot.sh stop +logfile = /var/log/rcboot.log +restart = false diff --git a/srcpkgs/dinit/files/dinit.d/rcboot.sh b/srcpkgs/dinit/files/dinit.d/rcboot.sh new file mode 100755 index 0000000..4addb4f --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/rcboot.sh @@ -0,0 +1,40 @@ +#!/bin/sh +export PATH=/usr/bin:/usr/sbin:/bin:/sbin +umask 0077 + +set -e + +if [ "$1" != "stop" ]; then + + # cleanup + # (delete /tmp etc) + rm -rf /tmp/* /tmp/.[!.]* /tmp/..?* + + # empty utmp, create needed directories + : > /var/run/utmp + mkdir -m og-w /var/run/dbus + + # Configure random number generator + if [ -e /var/state/random-seed ]; then + cat /var/state/random-seed > /dev/urandom; + fi + + # Configure network + /sbin/ifconfig lo 127.0.0.1 + + # You can put other static configuration here: + #/sbin/ifconfig eth0 192.168.1.38 netmask 255.255.255.0 broadcast 192.168.1.255 + + echo "myhost" > /proc/sys/kernel/hostname + + # /usr/sbin/alsactl restore + +else + + # The system is being shut down + + # echo "Saving random number seed..." + POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)" + dd if=/dev/urandom of=/var/state/random-seed bs="$POOLSIZE" count=1 2> /dev/null + +fi; diff --git a/srcpkgs/dinit/files/dinit.d/rootfscheck b/srcpkgs/dinit/files/dinit.d/rootfscheck new file mode 100644 index 0000000..9a2296f --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/rootfscheck @@ -0,0 +1,10 @@ +# Check the root filesystem. This is interruptible with ^C + +type = scripted +command = /etc/dinit.d/rootfscheck.sh start +restart = false +options = starts-on-console pass-cs-fd start-interruptible skippable +start-timeout = 0 # unlimited + +depends-on = udevd +waits-for = udev-trigger diff --git a/srcpkgs/dinit/files/dinit.d/rootfscheck.sh b/srcpkgs/dinit/files/dinit.d/rootfscheck.sh new file mode 100755 index 0000000..5588663 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/rootfscheck.sh @@ -0,0 +1,32 @@ +#!/bin/sh +export PATH=/usr/bin:/usr/sbin:/bin:/sbin + +if [ "$1" != "stop" ]; then + + ROOTDEV=`findmnt -v -o SOURCE -n -M /` + + echo "Checking root file system (^C to skip)..." + if [ -x /sbin/fsck ]; then + /sbin/fsck -C -a "$ROOTDEV" + fsckresult=$? + if [ $((fsckresult & 4)) -eq 4 ]; then + echo "***********************" + echo "WARNING WARNING WARNING" + echo "***********************" + echo "The root file system has problems which require user attention." + echo "A maintenance shell will now be started; system will then be rebooted." + /sbin/sulogin + /sbin/reboot --use-passed-cfd -r + elif [ $(($fsckresult & 2)) -eq 2 ]; then + echo "***********************" + echo "WARNING WARNING WARNING" + echo "***********************" + echo "The root file system had problems (now repaired): rebooting..." + sleep 5 + /sbin/reboot --use-passed-cfd -r + fi + else + echo "WARNING - Could not find /sbin/fsck" + fi + +fi; diff --git a/srcpkgs/dinit/files/dinit.d/rootrw b/srcpkgs/dinit/files/dinit.d/rootrw new file mode 100644 index 0000000..22467e7 --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/rootrw @@ -0,0 +1,11 @@ +# Re-mount the root filesystem read/write. + +type = scripted +command = /bin/mount -n -o remount,rw / +restart = false +options = starts-rwfs +logfile = /run/rootrw.log + +depends-on = udevd +waits-for = hwclock +waits-for = rootfscheck diff --git a/srcpkgs/dinit/files/dinit.d/udev-settle b/srcpkgs/dinit/files/dinit.d/udev-settle new file mode 100644 index 0000000..f8e3ddf --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/udev-settle @@ -0,0 +1,5 @@ +type = scripted +command = /bin/udevadm settle +restart = false +waits-for = udevd +waits-for = udev-trigger diff --git a/srcpkgs/dinit/files/dinit.d/udev-trigger b/srcpkgs/dinit/files/dinit.d/udev-trigger new file mode 100644 index 0000000..ab13a0b --- /dev/null +++ b/srcpkgs/dinit/files/dinit.d/udev-trigger @@ -0,0 +1,7 @@ +# Trigger udev events for already-present devices. + +type = scripted +command = /bin/udevadm trigger --action=add +logfile = /run/udev-trigger.log +restart = false +depends-on = udevd diff --git a/srcpkgs/dinit/files/drunner b/srcpkgs/dinit/files/drunner new file mode 100755 index 0000000..246cf5a --- /dev/null +++ b/srcpkgs/dinit/files/drunner @@ -0,0 +1,16 @@ +#!/bin/sh + +for i in $(ls /etc/sv/); do + mkdir -p /etc/dinit.d/runitb.d/"$i" + cp -r /etc/sv/"$i"/* /etc/dinit.d/runitb.d/"$i"/ + rm -rf /etc/dinit.d/runitb.d/"$i"/supervise + if [[ -x /etc/dinit.d/runitb.d/"$i"/log ]]; then + rm -rf /etc/dinit.d/runitb.d/"$i"/log/supervise + printf "type = process \nworking-dir = /etc/dinit.d/runitb.d/"$i"/log/ \ncommand = /etc/dinit.d/runitb.d/"$i"/log/run" > /etc/dinit.d/"$i"-log + fi + printf "type = process \nworking-dir = /etc/dinit.d/runitb.d/"$i"/ \ncommand = /etc/dinit.d/runitb.d/"$i"/run" > /etc/dinit.d/"$i" +done + +for i in $(ls /etc/runit/runsvdir/default/); do + ln -sf /etc/dinit.d/"$i" /etc/dinit.d/boot.d/ +done diff --git a/srcpkgs/dinit/template b/srcpkgs/dinit/template index 4d8c958..bb513e5 100644 --- a/srcpkgs/dinit/template +++ b/srcpkgs/dinit/template @@ -1,8 +1,8 @@ #!/bin/sh pkgname=dinit version=0.17.0 -revision=9 -short_desc="Like neofetch, but much faster because written in c (NOT MY SOFTWARE)" +revision=12 +short_desc="Simple Linux / BSD init system (NOT MY SOFTWARE)" maintainer="Tracker-Friendly " homepage="https://github.com/fastfetch-cli/fastfetch" license="GPL-3.0" @@ -29,4 +29,7 @@ do_install() { mv ${DESTDIR}/sbin/* ${DESTDIR}/usr/bin/ rm -rf ${DESTDIR}/sbin ls ${DESTDIR}/usr/bin + mkdir -p ${DESTDIR}/etc/dinit.d/ + cp -r ${FILESDIR}/dinit.d/* ${DESTDIR}/etc/dinit.d/ + vbin ${FILESDIR}/drunner }