#!/bin/bash set -e # if a bacula-director-$db package is installed, give a warning and # option to abort when upgrading from a version before 13.0.0 about # the disk space requirements of the database upgrade . /usr/share/debconf/confmodule if [ "$1" = upgrade ]; then if dpkg --compare-versions "$2" lt-nl "13.0.0"; then # check if a bacula-director-$db package is installed if dpkg-query -W -f='${Status}\n' bacula-director-{mysql,sqlite3,pgsql} 2>/dev/null | grep "^install ok .*" > /dev/null; then # if we are tested by piuparts, we don't show the warning and just go ahead # this test succeeds if PIUPARTS_PHASE is undefined - if it's defined, we're running under piuparts if [ -z ${PIUPARTS_PHASE+x} ]; then # first clear an answer from any previous runs, otherwise we can get stuck with "abort" db_reset bacula-common/db_upgrade_needs_space db_input critical bacula-common/db_upgrade_needs_space || true db_go || true db_get bacula-common/db_upgrade_needs_space if [ "$RET" = "false" ]; then db_stop exit 1 fi fi fi fi fi case "$1" in install) if ! getent passwd bacula >/dev/null; then echo -n "Adding user 'bacula'... " adduser --system --group --home /var/lib/bacula bacula >/dev/null 2>&1 usermod -c "Bacula" bacula usermod -G tape bacula echo "Ok." fi ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. exit 0