From 7eb1ee8305e43aabca921c43df3e66ca11f332c4 Mon Sep 17 00:00:00 2001 From: Nurahmadie Date: Sun, 9 Feb 2014 18:43:43 +0000 Subject: [PATCH] Add post installation and pre removal script for debian package. --- deb/drone/DEBIAN/postinst | 24 ++++++++++++++++++++++++ deb/drone/DEBIAN/prerm | 26 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100755 deb/drone/DEBIAN/postinst create mode 100755 deb/drone/DEBIAN/prerm diff --git a/deb/drone/DEBIAN/postinst b/deb/drone/DEBIAN/postinst new file mode 100755 index 00000000..776f572b --- /dev/null +++ b/deb/drone/DEBIAN/postinst @@ -0,0 +1,24 @@ +#!/bin/sh +set -e + +case "$1" in + abort-upgrade|abort-remove|abort-deconfigure|configure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +echo "Starting drone ..." +if [ -f /etc/init/drone.conf ]; then + if pidof /usr/local/bin/droned >/dev/null; then + service drone stop || exit $? + fi + service drone start && echo "Drone started." +fi + +#DEBHELPER# + +exit 0 diff --git a/deb/drone/DEBIAN/prerm b/deb/drone/DEBIAN/prerm new file mode 100755 index 00000000..a0f7be8c --- /dev/null +++ b/deb/drone/DEBIAN/prerm @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e +set -u + +case "$1" in + remove|remove-in-favour|deconfigure|deconfigure-in-favour) + if [ -f /etc/init/drone.conf ]; then + echo "Stopping drone ..." + service drone stop || exit $? + echo "Drone Stopped." + fi + ;; + + upgrade|failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0