From: James Page Date: Tue, 21 May 2013 08:20:53 +0000 (+0100) Subject: Use invoke-rc.d in maintainer scripts X-Git-Tag: v0.64~90^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F304%2Fhead;p=ceph.git Use invoke-rc.d in maintainer scripts Upstart configurations and sysv init scripts should be started and stopped using invoke-rc.d in maintainer scripts. This ensures the correct behaviour across both Debian (sysv) and Ubuntu (upstart) and in restricted environments such as schroot where start/stop of services from maintainer scripts is normally disabled. Signed-off-by: James Page --- diff --git a/debian/ceph-mds.postinst b/debian/ceph-mds.postinst index 7fcbf5c62304..316aa7b1040c 100644 --- a/debian/ceph-mds.postinst +++ b/debian/ceph-mds.postinst @@ -1,4 +1,5 @@ #!/bin/sh +# vim: set noet ts=8: # postinst script for ceph-mds # # see: dh_installdeb(1) @@ -20,7 +21,14 @@ set -e case "$1" in configure) - [ -x /sbin/start ] && start ceph-mds-all || : + invoke-rc.d ceph-mds-all start || { + RESULT=$? + # Ignore if ceph-mds-all upstart config does not + # exist or upstart is not in use + if [ $RESULT != 100 ]; then + exit $RESULT + fi + } ;; abort-upgrade|abort-remove|abort-deconfigure) : diff --git a/debian/ceph-mds.prerm b/debian/ceph-mds.prerm index c4af0994d948..e4cd62c985f9 100644 --- a/debian/ceph-mds.prerm +++ b/debian/ceph-mds.prerm @@ -1,5 +1,17 @@ #!/bin/sh +# vim: set noet ts=8: -[ -x /sbin/stop ] && stop ceph-mds-all || : +set -e -exit 0 \ No newline at end of file +invoke-rc.d ceph-mds-all stop || { + RESULT=$? + # Ignore if ceph-all upstart config does not + # exist or upstart is not in use + if [ $RESULT != 100 ]; then + exit $RESULT + fi +} + +#DEBHELPER# + +exit 0 diff --git a/debian/ceph.postinst b/debian/ceph.postinst index 090a91aa9bb3..cf760d02c09b 100644 --- a/debian/ceph.postinst +++ b/debian/ceph.postinst @@ -1,4 +1,5 @@ #!/bin/sh +# vim: set noet ts=8: # postinst script for ceph # # see: dh_installdeb(1) @@ -27,7 +28,14 @@ set -e case "$1" in configure) rm -f /etc/init/ceph.conf - [ -x /sbin/start ] && start ceph-all || : + invoke-rc.d ceph-all start || { + RESULT=$? + # Ignore if ceph-all upstart config does not + # exist or upstart is not in use + if [ $RESULT != 100 ]; then + exit $RESULT + fi + } ;; abort-upgrade|abort-remove|abort-deconfigure) : diff --git a/debian/ceph.prerm b/debian/ceph.prerm index 557a1dbdac05..17f8bcc30971 100644 --- a/debian/ceph.prerm +++ b/debian/ceph.prerm @@ -1,5 +1,17 @@ #!/bin/sh +# vim: set noet ts=8: -[ -x /sbin/stop ] && stop ceph-all || : +set -e -exit 0 \ No newline at end of file +invoke-rc.d ceph-all stop || { + RESULT=$? + # Ignore if ceph-all upstart config does not + # exist or upstart is not in use + if [ $RESULT != 100 ]; then + exit $RESULT + fi +} + +#DEBHELPER# + +exit 0