#!/bin/sh set -e # Function to check if upgrading from 2.0.x # $1 = previous version string is_upgrade_from_2_0_x() { if [ -n "$1" ]; then case "$1" in 2.0.*) return 0 ;; esac fi return 1 } warn_if_missing_backend_flag() { defaults_file="/etc/default/balboa" if [ -f "$defaults_file" ]; then args_line=$(grep -m1 '^BALBOA_ARGS=' "$defaults_file" || true) case "$args_line" in *" -b "*|*" -b"|*"-b "*) return 0 ;; esac if grep -q '^BALBOA_ARGS=' "$defaults_file"; then echo "balboa: NOTE: /etc/default/balboa does not contain the required -b flag for 2.1.x" echo "balboa: Please ensure BALBOA_ARGS contains: -b /etc/balboa/backend.yaml" fi fi } if [ "$1" = configure ]; then if ! getent passwd balboa >/dev/null; then adduser \ --system --group --home /var/lib/balboa balboa fi touch /var/log/balboa.log if ! dpkg-statoverride --list /var/log/balboa.log >/dev/null 2>&1; then dpkg-statoverride \ --quiet --update \ --add balboa balboa 0640 /var/log/balboa.log fi install -d -obalboa -gbalboa -m750 /var/run/balboa install -d -obalboa -gbalboa -m750 /var/lib/balboa install -d -obalboa -gbalboa -m750 /var/lib/balboa/db # Handle upgrade from 2.0.x if is_upgrade_from_2_0_x "$2"; then echo "balboa: Detected upgrade from version $2" warn_if_missing_backend_flag # Notify about removed database.yaml if [ -f /etc/balboa/database.yaml ]; then echo "balboa: Backend configuration is now handled via backend.yaml and" echo "balboa: the balboa-backend-* packages." fi echo "" echo "balboa: IMPORTANT - Configuration changes in 2.1.x:" echo "balboa: See /usr/share/doc/balboa/NEWS.Debian.gz for details" echo "balboa: See /usr/share/doc/balboa/README.Debian for upgrade guidance" echo "" fi fi #DEBHELPER#