Pass --no-start to dh_installinit in invirt-dev and run the initscript
authorEvan Broder <broder@mit.edu>
Thu, 17 Dec 2009 22:56:04 +0000 (17:56 -0500)
committerEvan Broder <broder@mit.edu>
Thu, 17 Dec 2009 22:56:04 +0000 (17:56 -0500)
by hand.

This works around a bug where init scripts are started before Python
modules have been fully installed.

svn path=/trunk/packages/invirt-dev/; revision=2630

debian/invirt-dev.postinst
debian/invirt-dev.prerm
debian/rules

index d9b6b9b..7427c1f 100755 (executable)
@@ -20,13 +20,12 @@ case "$1" in
            mkdir -p /srv/git
        fi
 
            mkdir -p /srv/git
        fi
 
-       invirt-build-conf
-            
         cat >>/etc/sudoers <<EOF
 ### BEGIN invirt-dev
 %repo   ALL=(repository)        ALWAYS_SET_HOME,NOPASSWD: /usr/bin/reprepro
 ### END invirt-dev
 EOF
         cat >>/etc/sudoers <<EOF
 ### BEGIN invirt-dev
 %repo   ALL=(repository)        ALWAYS_SET_HOME,NOPASSWD: /usr/bin/reprepro
 ### END invirt-dev
 EOF
+
         echo "-----"
         echo "invirt-dev: run"
         echo "  adduser --disabled-password \$user"
         echo "-----"
         echo "invirt-dev: run"
         echo "  adduser --disabled-password \$user"
@@ -44,3 +43,11 @@ EOF
         exit 1
     ;;
 esac
         exit 1
     ;;
 esac
+
+if [ -x /etc/init.d/invirt-dev ]; then
+    if hash invoke-rc.d 2>/dev/null; then
+        invoke-rc.d invirt-dev start
+    else
+        /etc/init.d/invirt-dev start
+    fi
+fi
index 5d8daa3..c86e7d3 100755 (executable)
@@ -19,7 +19,7 @@ set -e
 
 case "$1" in
     remove|upgrade|deconfigure)
 
 case "$1" in
     remove|upgrade|deconfigure)
-        perl -i.bak -ne 's%^### (BEGIN|END) invirt-dev\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers
+        perl -i.bak -ne 's%^### (BEGIN|END) invirt-dev\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers        
     ;;
 
     failed-upgrade)
     ;;
 
     failed-upgrade)
@@ -31,6 +31,14 @@ case "$1" in
     ;;
 esac
 
     ;;
 esac
 
+if [ -x /etc/init.d/invirt-dev ]; then
+    if hash invoke-rc.d 2>/dev/null; then
+        invoke-rc.d invirt-dev stop
+    else
+        /etc/init.d/invirt-dev stop
+    fi
+fi
+
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
 
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
 
index ef4b266..4bde507 100755 (executable)
@@ -2,6 +2,14 @@
 
 DEB_PYTHON_SYSTEM=pysupport
 
 
 DEB_PYTHON_SYSTEM=pysupport
 
+# We use --no-start instead of letting dh_installinit do its thing
+# because, in the postinst, dh_installinit's automatically added code
+# runs before dh_pysupport's automatically added code.
+#
+# This means that when the initscript is started, Python modules
+# installed by the package haven't been fully installed yet.
+DEB_DH_INSTALLINIT_ARGS += --no-start
+
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/python-distutils.mk
 
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/python-distutils.mk