Skip to content

Commit

Permalink
Add support for starting/stopping deamons.
Browse files Browse the repository at this point in the history
On debian and ubuntu the init scripts are not registered on install and
unregistered on deinstall of the package. Added the right calls to the
postint script of the different daemons and added prerm scripts to do
the right thing on deinstall.

Fixes #86: No start scripts created during installation
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent bf60290 commit 9355be4
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debian/bareos-director.postinst
Expand Up @@ -31,12 +31,18 @@ permissions()
chown ${director_daemon_user}:${daemon_group} /etc/bareos/bareos-dir.conf
}

enable_rc_scripts()
{
update-rc.d bareos-dir defaults
}

case "$1" in
configure)
permissions
/usr/lib/bareos/scripts/bareos-config initialize_local_hostname
/usr/lib/bareos/scripts/bareos-config initialize_passwords
/usr/lib/bareos/scripts/bareos-config initialize_database_driver
enable_rc_scripts
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
Expand Down
41 changes: 41 additions & 0 deletions debian/bareos-director.prerm
@@ -0,0 +1,41 @@
#!/bin/sh
# prerm script for bareos
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

disable_rc_scripts()
{
update-rc.d -f bareos-dir remove
}

case "$1" in
remove|deconfigure)
disable_rc_scripts
;;
failed-upgrade|upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
6 changes: 6 additions & 0 deletions debian/bareos-filedaemon.postinst
Expand Up @@ -31,11 +31,17 @@ permissions()
chown ${file_daemon_user}:${daemon_group} /etc/bareos/bareos-fd.conf
}

enable_rc_scripts()
{
update-rc.d bareos-fd defaults
}

case "$1" in
configure)
permissions
/usr/lib/bareos/scripts/bareos-config initialize_local_hostname
/usr/lib/bareos/scripts/bareos-config initialize_passwords
enable_rc_scripts
;;

abort-upgrade|abort-remove|abort-deconfigure)
Expand Down
41 changes: 41 additions & 0 deletions debian/bareos-filedaemon.prerm
@@ -0,0 +1,41 @@
#!/bin/sh
# prerm script for bareos
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

disable_rc_scripts()
{
update-rc.d -f bareos-fd remove
}

case "$1" in
remove|deconfigure)
disable_rc_scripts
;;
failed-upgrade|upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
6 changes: 6 additions & 0 deletions debian/bareos-storage.postinst
Expand Up @@ -32,11 +32,17 @@ permissions()
chown ${storage_daemon_user}:${daemon_group} /var/lib/bareos/storage/
}

enable_rc_scripts()
{
update-rc.d bareos-sd defaults
}

case "$1" in
configure)
permissions
/usr/lib/bareos/scripts/bareos-config initialize_local_hostname
/usr/lib/bareos/scripts/bareos-config initialize_passwords
enable_rc_scripts
;;

abort-upgrade|abort-remove|abort-deconfigure)
Expand Down
41 changes: 41 additions & 0 deletions debian/bareos-storage.prerm
@@ -0,0 +1,41 @@
#!/bin/sh
# prerm script for bareos
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

disable_rc_scripts()
{
update-rc.d -f bareos-sd remove
}

case "$1" in
remove|deconfigure)
disable_rc_scripts
;;
failed-upgrade|upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0

0 comments on commit 9355be4

Please sign in to comment.