Package: runit-init
Version: 2.1.2-13
Severity: wishlist


-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.15.12-van (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages runit-init depends on:
ii  getty-run     2.1.2-13
ii  initscripts   2.88dsf-59.10
ii  libc6         2.27-3
ii  runit         2.1.2-13
ii  runit-helper  2.7.2
ii  sysv-rc       2.88dsf-59.10

runit-init recommends no packages.

runit-init suggests no packages.

-- no debconf information

-- debsums errors found:
debsums: changed file /sbin/shutdown (from runit-init package)


Hi,
I would like to share a setup that uses runit's code for reboot/shutdown: this 
way shutdown/reboot's external
code is used only when switching init.
Also, the /etc/init.d/rc script is no longer used for the shutdown sequence.
I'm currently using this on my pc and i have tested the systemd-->runit-init 
sitch on Virtualbox and works for me.
Sharing in case you want to use it or just take some ideas from it.

mv /sbin/shutdown /sbin/shutdown-sysv
rm /sbin/reboot
rm /sbin/halt


/etc/runit/3
--------------------------------------------------
#!/bin/sh
exec 2>&1

PATH=/sbin:/usr/sbin:/bin:/usr/bin

# LAST=0

# While test -x is more natural, it does not consider file with
# executable bit set on 'noexec' filesystem as executable, and /run
# often is mounted as 'noexec'.
# [ $(stat -c %a /run/runit.reboot) = 100 ] && LAST=6

echo 'Waiting for services to stop...'
sv force-stop /etc/service/*
sv exit /etc/service/*

# Stop sysv services, reverse order
run-parts --reverse --regex=S --arg=stop -- /etc/rc2.d

# Print a message, not really essential since runit will print
# a similar message when exiting stage 3 

if [ -e /run/runit.reboot ]; then
   echo 'Shutdown: reboot...'
else
   echo 'Shutdown: poweroff...'
fi

# perform shutdown tasks using initscripts
# skip reboot/halt scripts so that runit uses it's own code
for script in /etc/rc0.d/K* ; do
   echo $script | grep -vq halt && $script stop
done

# echo 'Shutdown...'
# /etc/init.d/rc $LAST


---------------------------------------------

cat /sbin/shutdown
#!/bin/sh

if [ -e /run/runit.stopit ]; then
   init 0
else
   exec /sbin/shutdown-sysv
fi

---------------------------

cat /sbin/reboot
#!/bin/sh

if [ -e /run/runit.stopit ]; then
   touch /run/runit.reboot && init 6
else
    if [ "$2" = -f ]; then
      exec /sbin/shutdown-sysv -f
    else
      exec /sbin/shutdown-sysv
    fi
fi

-----------------------------

cat /sbin/halt
#!/bin/sh

# /etc/init.d/unmountnfs.sh is doing "halt -w" before unmounting.
# shutdown.c only supports -f option.
# halt -w makes runit print a warning ("signals only work in stage 2")
# then runit perform a poweroff even if it was correctly instructed to reboot

if [ -e /run/runit.stopit ] && [ "$1" = -w ] ; then
    echo 'halt: -w option not yet supported'
else
    exec /sbin/shutdown-sysv
fi
---------------------------

Thanks

Lorenzo

Reply via email to