| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
# if a bacula-director-$db package is installed, give a warning and |
| 6 |
# option to abort when upgrading from a version before 13.0.0 about |
| 7 |
# the disk space requirements of the database upgrade |
| 8 |
. /usr/share/debconf/confmodule |
| 9 |
if [ "$1" = upgrade ]; then |
| 10 |
if dpkg --compare-versions "$2" lt-nl "13.0.0"; then |
| 11 |
# check if a bacula-director-$db package is installed |
| 12 |
if dpkg-query -W -f='${Status}\n' bacula-director-{mysql,sqlite3,pgsql} 2>/dev/null | grep "^install ok .*" > /dev/null; then |
| 13 |
# if we are tested by piuparts, we don't show the warning and just go ahead |
| 14 |
# this test succeeds if PIUPARTS_PHASE is undefined - if it's defined, we're running under piuparts |
| 15 |
if [ -z ${PIUPARTS_PHASE+x} ]; then |
| 16 |
# first clear an answer from any previous runs, otherwise we can get stuck with "abort" |
| 17 |
db_reset bacula-common/db_upgrade_needs_space |
| 18 |
db_input critical bacula-common/db_upgrade_needs_space || true |
| 19 |
db_go || true |
| 20 |
db_get bacula-common/db_upgrade_needs_space |
| 21 |
if [ "$RET" = "false" ]; then |
| 22 |
db_stop |
| 23 |
echo "Stopped upgrade of bacula-director. Please retry after you have made" |
| 24 |
echo "sure that you have enough space and time to perform the database" |
| 25 |
echo "schema upgrade." |
| 26 |
exit 1 |
| 27 |
fi |
| 28 |
fi |
| 29 |
fi |
| 30 |
fi |
| 31 |
fi |
| 32 |
|
| 33 |
case "$1" in |
| 34 |
install) |
| 35 |
if ! getent passwd bacula >/dev/null; then |
| 36 |
echo -n "Adding user 'bacula'... " |
| 37 |
adduser --system --group --home /var/lib/bacula bacula >/dev/null 2>&1 |
| 38 |
usermod -c "Bacula" bacula |
| 39 |
usermod -G tape bacula |
| 40 |
echo "Ok." |
| 41 |
fi |
| 42 |
;; |
| 43 |
esac |
| 44 |
|
| 45 |
# dh_installdeb will replace this with shell code automatically |
| 46 |
# generated by other debhelper scripts. |
| 47 |
|
| 48 |
#DEBHELPER# |
| 49 |
|
| 50 |
exit 0 |