From 23055b3d7da4bfef00d302e91b87fa36f6f9be96 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Fri, 7 Feb 2020 17:34:55 +0300 Subject: sinit: add changes * Use official sources * Switch to 1.0 * Remove the ubase dependency * Use kpow by Dylan Araps for shutdown --- core/sinit/build | 23 +++++++---------------- core/sinit/checksums | 10 +++++----- core/sinit/files/poweroff | 1 - core/sinit/files/sinit-launch-services.boot | 20 ++++++++------------ core/sinit/files/sinit.post.shutdown | 17 +---------------- core/sinit/post-install | 28 +++++++++++++++++++--------- core/sinit/sources | 4 ++-- core/sinit/version | 2 +- 8 files changed, 43 insertions(+), 62 deletions(-) (limited to 'core/sinit') diff --git a/core/sinit/build b/core/sinit/build index 4a3a1bf2..1466e64d 100755 --- a/core/sinit/build +++ b/core/sinit/build @@ -1,24 +1,15 @@ #!/bin/sh -e -ls -cp config.h sinit/config.h -cd sinit -make CFLAGS="$CFLAGS -static" PREFIX=/usr DESTDIR="$1" install -mv "$1/usr/bin/sinit" "$1/usr/bin/init" +( + cd sinit + make CFLAGS="$CFLAGS -static" PREFIX=/usr DESTDIR="$1" install +) +ln -s sinit "$1/usr/bin/init" -cd .. install -Dm755 poweroff "$1/usr/bin/poweroff" install -Dm755 reboot "$1/usr/bin/reboot" install -Dm644 sinit-launch-services.boot "$1/etc/init/sinit-launch-services.boot" -install -Dm644 sinit.post.shutdown "$1/etc/init/sinit.post.shutdown" -# We are building ubase here so we don't need -# the full package - -cd ubase -make halt -make respawn - -install -Dm755 halt "$1/usr/bin/halt" -install -Dm755 respawn "$1/usr/bin/respawn" +# shellcheck disable=2086 +"${CC:-gcc}" -o "$1/usr/bin/kpow" init/bin/kpow.c $CFLAGS -static diff --git a/core/sinit/checksums b/core/sinit/checksums index 5ce16c76..d3d7b051 100644 --- a/core/sinit/checksums +++ b/core/sinit/checksums @@ -1,7 +1,7 @@ -aaccd0515070545174bf962c462686e7719c02c68004bd0b350b98b4c78a90ba sinit-1.1.tar.gz -2fd1cd03b9ea9b0d08a523634be942177f1a370daa9a120e0279316003fb0ec1 b33bdaa.tar.gz +78c2120a97a5e93b80606c5403bd731152f8a344e47aa4ab74970c1c11dc6fc0 sinit-1.0.tar.gz +c334ec2395fab8e45800c97b2f032395262ea7e61adc2be2f3b59fd565c292d8 0.4.tar.gz 6f0f1a5f2f43b5bcfd4beaa93e1a49438d398cf758d7813bc6ba86b5156357a8 config.h f638aaa23383da584d3a56347a8e279abdc7c9c521661ef54a5bc8b955c5632b reboot -d21a020d7cdb6a328962adac7cc1a8701a413c1dfabd40ac00bf7dc212fa29d1 poweroff -b8638d409b57b21d0deb11b6c0a5a870c0a6088d7733b205b0265bcc03d13486 sinit-launch-services.boot -913696a0bad385add0ea6207d5c6a8708fb4c74af7340715b12e98a094307e5c sinit.post.shutdown +4da8b0c2771a9046a7ce2ded49beb5297045e9979796e5e4b390168286f05379 poweroff +3aa8642d8a1058876f3a47639640a81887298eac992bf15e41fbe420738b09ef sinit-launch-services.boot +5e2541aa672d80a8d0fcef694e4a4e74b8a0b12d415e7189228b793a4411ccd1 sinit.post.shutdown diff --git a/core/sinit/files/poweroff b/core/sinit/files/poweroff index 69e8f9a4..69d8731e 100644 --- a/core/sinit/files/poweroff +++ b/core/sinit/files/poweroff @@ -1,3 +1,2 @@ #!/bin/sh - /bin/kill -s USR1 1 diff --git a/core/sinit/files/sinit-launch-services.boot b/core/sinit/files/sinit-launch-services.boot index 4cbb0570..6ba14057 100644 --- a/core/sinit/files/sinit-launch-services.boot +++ b/core/sinit/files/sinit-launch-services.boot @@ -1,14 +1,10 @@ -# we are going to start runit and getty here +# We are going to start runit and getty here -sinit_run_getty() { - for getty in 1 2 3 4 5 6; do - respawn /sbin/getty 38400 tty${getty} 2>&1 & - done -} +# Uncomment to enable gettys +# for getty in 1 2 3 4 5 6 ; do +# while :; do /sbin/getty tty${getty} 0 linux ; done & # busybox getty +# # while :; do /sbin/getty tty${getty} linux ; done & # ubase getty +# done -sinit_runit() { - respawn /usr/bin/runsvdir -P /var/service & -} - -[ "$SINIT_ENABLE_GETTY" = 1 ] && sinit_run_getty -[ "$SINIT_ENABLE_RUNIT" = 1 ] && sinit_runit +# Uncomment enable runit services +# while :; do /usr/bin/runsvdir -P /var/service ; done & diff --git a/core/sinit/files/sinit.post.shutdown b/core/sinit/files/sinit.post.shutdown index 4f3c793b..5ce4d8ec 100644 --- a/core/sinit/files/sinit.post.shutdown +++ b/core/sinit/files/sinit.post.shutdown @@ -1,16 +1 @@ -# vim:filetype=sh - -# We handle the shutdown from here - -if [ "$SINIT_SHUTDOWN_HOOKS" = 1 ]; then - case "$1" in - reboot) - out "Requesting system reboot..." - halt -r - ;; - *) - out "Requesting system poweroff..." - halt -p - ;; - esac -fi +case "$1" in reboot) kpow r ;; poweroff) kpow p ;; esac diff --git a/core/sinit/post-install b/core/sinit/post-install index 1f3fdf30..50170454 100755 --- a/core/sinit/post-install +++ b/core/sinit/post-install @@ -1,16 +1,26 @@ #!/bin/sh -e -grep -q SINIT_ /etc/init/rc.conf || cat <> /etc/init/rc.conf +cat <