summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2011-04-21 17:19:33 +0200
committerTollef Fog Heen <tfheen@err.no>2011-04-21 17:19:33 +0200
commit44b765a9e8ed588413d2c4ecde36a3763094e64d (patch)
treeb3152c05af86b29f8b21e6418dbcc8beca2673b5
parent91d02107fbaefc7ae11997d7e8ddb871267917de (diff)
downloadsystemd-44b765a9e8ed588413d2c4ecde36a3763094e64d.tar.gz
Divert lsb init-functions instead of abusing logging hook
-rw-r--r--debian/changelog3
-rw-r--r--debian/init-functions (renamed from debian/lsb-base-logging.sh)16
-rw-r--r--debian/systemd.postinst2
-rw-r--r--debian/systemd.postrm14
-rw-r--r--debian/systemd.preinst14
5 files changed, 46 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index 5a633f4b8d..a626d8fb0b 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 <tfheen@debian.org> Thu, 21 Apr 2011 13:50:13 +0200
diff --git a/debian/lsb-base-logging.sh b/debian/init-functions
index 2998bdbb37..444834d2d2 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 f70dc3c8cd..75d19cc2c0 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 0000000000..0565e8c06f
--- /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 0000000000..248546d7a9
--- /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