~carbslinux/repository

23055b3d7da4bfef00d302e91b87fa36f6f9be96 — Cem Keylan 1 year, 8 months ago c416432
sinit: add changes
* Use official sources
* Switch to 1.0
* Remove the ubase dependency
* Use kpow by Dylan Araps for shutdown
M core/sinit/build => core/sinit/build +7 -16
@@ 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

M core/sinit/checksums => core/sinit/checksums +5 -5
@@ 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

M core/sinit/files/poweroff => core/sinit/files/poweroff +0 -1
@@ 1,3 1,2 @@
#!/bin/sh

/bin/kill -s USR1 1

M core/sinit/files/sinit-launch-services.boot => core/sinit/files/sinit-launch-services.boot +8 -12
@@ 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 &

M core/sinit/files/sinit.post.shutdown => core/sinit/files/sinit.post.shutdown +1 -16
@@ 1,16 1,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

M core/sinit/post-install => core/sinit/post-install +19 -9
@@ 1,16 1,26 @@
#!/bin/sh -e

grep -q SINIT_ /etc/init/rc.conf || cat <<EOF >> /etc/init/rc.conf
cat <<EOF

# Comment these to run the scripts for sinit
SINIT_SHUTDOWN_HOOKS=1
SINIT_ENABLE_GETTY=1
SINIT_ENABLE_RUNIT=1
EOF
!! IMPORTANT !!

cat <<EOF
To start using sinit, edit
/etc/init/sinit-launch-services.boot
And uncomment the getty function, and
Optionally uncomment the runit function
If you deem necessary.

sinit is installed as /usr/bin/sinit. It
can fully replace busybox init by running
the following command.

      kiss a | grep ^sinit | kiss a -

Important: If you want to replace sinit, you need to 
edit your /etc/init/rc.conf to disable SINIT variables."
NOTE: If swapping from busybox init on a 
      running system, shutdown/reboot by 
      invoking 'busybox-init poweroff'. 
      sinit's poweroff/reboot utilities 
      can't be of use until it is actually 
      running.

EOF

M core/sinit/sources => core/sinit/sources +2 -2
@@ 1,5 1,5 @@
https://dl.carbslinux.org/distfiles/sinit-1.1.tar.gz sinit
https://github.com/michaelforney/ubase/archive/b33bdaa.tar.gz ubase
https://dl.suckless.org/sinit/sinit-1.0.tar.gz sinit
https://github.com/kisslinux/init/archive/0.4.tar.gz init
files/config.h
files/reboot
files/poweroff

M core/sinit/version => core/sinit/version +1 -1
@@ 1,1 1,1 @@
1.1 3
1.0 1