[DRE-commits] [unicorn] 01/01: prevent auto-enable of SysV daemon on first install:

Dmitry Smirnov onlyjob at moszumanska.debian.org
Mon Jun 22 01:50:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

onlyjob pushed a commit to branch master
in repository unicorn.

commit 5c1c2d6 (HEAD, master)
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date:   Mon Jun 22 01:45:34 2015

    prevent auto-enable of SysV daemon on first install:
    
     * Removed custom service start/stop code from {prerm|postinst}.
       (let debhelper handle start/stop/restart of the service).
     * Added postinst code to disable SysV daemon after first install.
     * Added lintian-override for the above postinst workaround.
---
 debian/unicorn.lintian-overrides |  2 ++
 debian/unicorn.postinst          | 67 ++++++----------------------------------
 debian/unicorn.prerm             | 19 ------------
 3 files changed, 11 insertions(+), 77 deletions(-)

diff --git a/debian/unicorn.lintian-overrides b/debian/unicorn.lintian-overrides
new file mode 100644
index 0000000..d75bcb6
--- /dev/null
+++ b/debian/unicorn.lintian-overrides
@@ -0,0 +1,2 @@
+## Override for postinst workaround to prevent auto-enable of SysV service:
+duplicate-updaterc.d-calls-in-postinst
diff --git a/debian/unicorn.postinst b/debian/unicorn.postinst
index 18d4cd7..b6869db 100644
--- a/debian/unicorn.postinst
+++ b/debian/unicorn.postinst
@@ -2,63 +2,14 @@
 
 set -e
 
-if [ $1 != "configure" ] ; then
-  exit 0
-fi
-
-if [ -f /etc/default/unicorn ]; then
-  . /etc/default/unicorn
-fi
-
-TIMEOUT=${TIMEOUT-60}
-PID=${PID-/run/unicorn.pid}
-OLD_PID="${PID}.oldbin"
-
-invoke() {
-  if [ -x "$(which invoke-rc.d)" ]; then
-    invoke-rc.d $1 $2
-  else
-    /etc/init.d/$1 $2
-  fi
-}
-
-running() {
-  invoke $1 status >/dev/null 2>&1
-}
-
-sig() {
-  test -s $PID && kill -$1 `cat $PID`
-}
-
-oldsig() {
-  test -s $OLD_PID && kill -$1 `cat $OLD_PID`
-}
-
-upgrade() {
-  echo "Trying to upgrade running server"
-  if sig USR2 && sleep 2 && sig 0 && oldsig QUIT ; then
-    n=$TIMEOUT
-    while test -s $OLD_PID && test $n -ge 0 ; do
-      printf '.' && sleep 1 && n=`expr $n - 1`
-    done
-
-    if test $n -lt 0 && test -s $OLD_PID; then
-      echo "$OLD_PID still exists after $TIMEOUT seconds. Killing and starting new."
-      sig KILL || true
-      oldsig KILL || true
-      invoke unicorn start || exit $?
-    fi
-  fi
-}
-
-if [ -x /etc/init.d/unicorn ]; then
-    if running unicorn; then
-      upgrade
-    else
-      invoke unicorn start || exit $?
-    fi
-fi
-
 #DEBHELPER#
 
-exit 0
+case "$1" in
+    configure*)
+        if [ -z "$2" -a -x "$(which update-rc.d)" ]; then
+            ## sysv: override auto-enable on first install.
+            ## Causes Lintian error: "duplicate-updaterc.d-calls-in-postinst".
+            update-rc.d unicorn disable >>/dev/null || true
+        fi
+    ;;
+esac
diff --git a/debian/unicorn.prerm b/debian/unicorn.prerm
deleted file mode 100644
index ffa9a92..0000000
--- a/debian/unicorn.prerm
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-set -e
-
-case "$1" in
-  remove|deconfigure)
-    if [ -x /etc/init.d/unicorn ]; then
-      if [ -x "$(which invoke-rc.d)" ]; then
-        invoke-rc.d unicorn stop
-      else
-        /etc/init.d/unicorn stop
-      fi
-    fi
-  ;;
-esac
-
-#DEBHELPER#
-
-exit 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/unicorn.git



More information about the Pkg-ruby-extras-commits mailing list