#!/bin/sh set -e #keep until trixie+1: remove /etc/runit/2 from inittab so that it's replaced # by /etc/runit/runsvdir-start if [ "$1" = configure ] && dpkg --compare-versions "$2" le-nl 2.1.2-59; then if [ -f /etc/inittab ]; then awk ' /^#runit-sysv maintscript -- BEGIN/ { flag = 1 } { if (flag == 0) print; } /^#runit-sysv maintscript -- END/ { flag = 0 } ' /etc/inittab > /etc/inittab.tmp sed -i '${/^$/d}' /etc/inittab.tmp mv /etc/inittab.tmp /etc/inittab fi fi #end keep rescan_inittab () { # other inits maintain a compat initctl pipe, so we check that is not # systemd, that initctl exists and that sysvinit-core is installed if [ ! -d /run/systemd/system ] && [ -e /run/initctl ] ; then if [ -e /sbin/telinit ] ; then # rescan inittab to pick new entry telinit q fi fi } write_inittab () { if ! grep -q '^#runit-sysv maintscript -- BEGIN' /etc/inittab ; then cat /etc/inittab - < /etc/inittab.tmp #runit-sysv maintscript -- BEGIN SV:123456:respawn:/etc/runit/runsvdir-start #runit-sysv maintscript -- END EOF mv /etc/inittab.tmp /etc/inittab rescan_inittab fi } if [ -f /etc/inittab ]; then write_inittab fi case "$1" in triggered) write_inittab ;; esac # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'runit.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'runit.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'runit.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'runit.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true deb-systemd-invoke start 'runit.service' >/dev/null || true fi fi # End automatically added section