Dinit update!

This commit is contained in:
Tracker-Friendly 2023-08-28 22:56:39 +01:00
parent 8efbb051ef
commit 4c6a1fad40
25 changed files with 194 additions and 2 deletions

4
srcpkgs/dinit/INSTALL Normal file
View File

@ -0,0 +1,4 @@
case "$ACTION" in
post)
drunner
esac

View File

@ -0,0 +1,2 @@
type = internal
waits-for.d = boot.d

View File

@ -0,0 +1 @@
../drunner

View File

@ -0,0 +1 @@
../early-filesystems

View File

@ -0,0 +1 @@
../hostname

View File

@ -0,0 +1 @@
../hwclock

View File

@ -0,0 +1 @@
../rcboot

View File

@ -0,0 +1 @@
../rootfscheck

View File

@ -0,0 +1 @@
../rootrw

View File

@ -0,0 +1 @@
../udev-settle

View File

@ -0,0 +1 @@
../udev-trigger

View File

@ -0,0 +1,6 @@
# Translate runit services
type = scripted
command = /bin/drunner
restart = false

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,5 @@
# Set the hostname
type = scripted
command = /bin/hostname -F /etc/hostname
restart = false

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -0,0 +1,5 @@
type = scripted
command = /bin/udevadm settle
restart = false
waits-for = udevd
waits-for = udev-trigger

View File

@ -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

16
srcpkgs/dinit/files/drunner Executable file
View File

@ -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

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
pkgname=dinit pkgname=dinit
version=0.17.0 version=0.17.0
revision=9 revision=12
short_desc="Like neofetch, but much faster because written in c (NOT MY SOFTWARE)" short_desc="Simple Linux / BSD init system (NOT MY SOFTWARE)"
maintainer="Tracker-Friendly <jliwin98@danwin1210.de>" maintainer="Tracker-Friendly <jliwin98@danwin1210.de>"
homepage="https://github.com/fastfetch-cli/fastfetch" homepage="https://github.com/fastfetch-cli/fastfetch"
license="GPL-3.0" license="GPL-3.0"
@ -29,4 +29,7 @@ do_install() {
mv ${DESTDIR}/sbin/* ${DESTDIR}/usr/bin/ mv ${DESTDIR}/sbin/* ${DESTDIR}/usr/bin/
rm -rf ${DESTDIR}/sbin rm -rf ${DESTDIR}/sbin
ls ${DESTDIR}/usr/bin ls ${DESTDIR}/usr/bin
mkdir -p ${DESTDIR}/etc/dinit.d/
cp -r ${FILESDIR}/dinit.d/* ${DESTDIR}/etc/dinit.d/
vbin ${FILESDIR}/drunner
} }