From: Tollef Fog Heen Date: Thu, 21 Apr 2011 15:19:33 +0000 (+0200) Subject: Divert lsb init-functions instead of abusing logging hook X-Git-Tag: 25-1~3 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44b765a9e8ed588413d2c4ecde36a3763094e64d;p=systemd Divert lsb init-functions instead of abusing logging hook --- diff --git a/debian/changelog b/debian/changelog index 5a633f4b..a626d8fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,9 @@ systemd (25-1) experimental; urgency=low * Add Conflicts on klogd, since it doesn't work correctly with the kmg→/dev/log bridge. Closes: #622555 * Add suggests on Python for systemd-analyze. + * Divert /lib/lsb/init-functions instead of (ab)using + /etc/lsb-base-logging.sh for diverting calls to /etc/init.d/* + * Remove obsolete conffile /etc/lsb-base-logging.sh. Closes: #619093 -- Tollef Fog Heen Thu, 21 Apr 2011 13:50:13 +0200 diff --git a/debian/lsb-base-logging.sh b/debian/init-functions similarity index 82% rename from debian/lsb-base-logging.sh rename to debian/init-functions index 2998bdbb..444834d2 100644 --- a/debian/lsb-base-logging.sh +++ b/debian/init-functions @@ -1,8 +1,7 @@ # -*-Shell-script-*- -# /etc/lsb-base-logging.sh +# /lib/lsb/init-functions if [ -e /sys/fs/cgroup/systemd ] ; then - # Some init scripts use "set -e" and "set -u", we don't want that # here set +e @@ -18,12 +17,21 @@ if [ -e /sys/fs/cgroup/systemd ] ; then # Redirect SysV init scripts when executed by the user if [ $PPID -ne 1 ] && [ -z "$init" ] && [ -z "$_SYSTEMCTL_SKIP_REDIRECT" ] ; then - case "$0" in + case $(readlink -f "$0") in /etc/init.d/*) # Don't redirect if the init script has X-Interactive: true if ! grep -qs "^# X-Interactive:.*true" "$0"; then _use_systemctl=1 fi + # Redirect if there's a matching .service file in /etc or /lib + local prog=${0##*/} + local service="${prog%.sh}.service" + local fp=$(systemctl -p FragmentPath show $service 2>/dev/null | sed 's/^FragmentPath=//') + case "$fp" in + /lib/systemd/system/*|/etc/systemd/system/*) + _use_systemctl=1 + ;; + esac ;; esac else @@ -82,3 +90,5 @@ if [ "$_use_systemctl" = "1" ]; then exit $? fi fi + +. /lib/lsb/init-functions.systemd diff --git a/debian/systemd.postinst b/debian/systemd.postinst index f70dc3c8..75d19cc2 100644 --- a/debian/systemd.postinst +++ b/debian/systemd.postinst @@ -20,4 +20,6 @@ fi systemd-machine-id-setup +dpkg-maintscript-helper rm_conffile /etc/lsb-base-logging.sh 20-1 systemd -- "$@" + #DEBHELPER# diff --git a/debian/systemd.postrm b/debian/systemd.postrm new file mode 100644 index 00000000..0565e8c0 --- /dev/null +++ b/debian/systemd.postrm @@ -0,0 +1,14 @@ +#! /bin/sh + +set -e + +if [ "$1" = remove ]; then + dpkg-divert --remove --package systemd --rename \ + --divert /lib/lsb/init-functions.systemd /lib/lsb/init-functions +fi + +dpkg-maintscript-helper rm_conffile /etc/lsb-base-logging.sh 20-1 systemd -- "$@" + +#DEBHELPER# + +exit 0 diff --git a/debian/systemd.preinst b/debian/systemd.preinst new file mode 100644 index 00000000..248546d7 --- /dev/null +++ b/debian/systemd.preinst @@ -0,0 +1,14 @@ +#! /bin/sh + +set -e + +if [ "$1" = install ] || [ "$1" = upgrade ]; then + dpkg-divert --add --package systemd --rename \ + --divert /lib/lsb/init-functions.systemd /lib/lsb/init-functions +fi + +dpkg-maintscript-helper rm_conffile /etc/lsb-base-logging.sh 20-1 systemd -- "$@" + +#DEBHELPER# + +exit 0 \ No newline at end of file