]> err.no Git - systemd/commitdiff
Divert lsb init-functions instead of abusing logging hook
authorTollef Fog Heen <tfheen@err.no>
Thu, 21 Apr 2011 15:19:33 +0000 (17:19 +0200)
committerTollef Fog Heen <tfheen@err.no>
Thu, 21 Apr 2011 15:19:33 +0000 (17:19 +0200)
debian/changelog
debian/init-functions [moved from debian/lsb-base-logging.sh with 82% similarity]
debian/systemd.postinst
debian/systemd.postrm [new file with mode: 0644]
debian/systemd.preinst [new file with mode: 0644]

index 5a633f4b8d99552dac6d2f3677eff28895238298..a626d8fb0beb59bcacbe5492fe042794195c58b9 100644 (file)
@@ -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
 
similarity index 82%
rename from debian/lsb-base-logging.sh
rename to debian/init-functions
index 2998bdbb37df219e73e149b4b45ee400a9870a30..444834d2d27f488099926ee3099dcc4566188f21 100644 (file)
@@ -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
index f70dc3c8cde233a84f50feefbb9f79753a6c1c67..75d19cc2c00414dce30b2bca178292b552e67799 100644 (file)
@@ -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 (file)
index 0000000..0565e8c
--- /dev/null
@@ -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 (file)
index 0000000..248546d
--- /dev/null
@@ -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