#!/bin/sh # preinst script for ledgersmb # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # Set old_version variable for use later in the script. old_version=$2 # If upgrading from a pre 1.5.x version of the ledgersmb package, # then it would have been using the old apache configuration and that # needs to be removed. remove_old_config() { # If /etc/ledgersmb/ledgersmb-httpd-2.4.conf exists, remove it. if [ -h "/etc/ledgersmb/ledgersmb-httpd-2.4.conf" ]; then rm -f /etc/ledgersmb/ledgersmb-httpd-2.4.conf fi # If /etc/apache2/conf-available/ledgersmb.conf exists, remove it. if [ -f "/etc/apache2/conf-available/ledgersmb.conf" ]; then rm -f /etc/apache2/conf-available/ledgersmb.conf fi # If /etc/apache2/conf-available/ledgersmb.conf exists, remove # it and deregister it with ucf. if [ -f "/etc/apache2/conf-available/ledgersmb.conf" ]; then # Remove the possible backup extensions of the configuration file. for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do rm -f /etc/apache2/conf-available/ledgersmb.conf$ext done fi # Remove the configuration file itself rm -f /etc/apache2/conf-available/ledgersmb.conf # Clear it out from the ucf database. if which ucf >/dev/null 2>&1; then ucf --purge /etc/apache2/conf-available/ledgersmb.conf fi if which ucfr >/dev/null 2>&1; then ucfr --purge ledgersmb /etc/apache2/conf-available/ledgersmb.conf fi } case "$1" in install) # If this is an upgrade from a previous version of the package... if [ ! -z "$old_version" ]; then # If the old installed package version is pre v1.5.x, then remove # the old configuration being used with Apache if dpkg --compare-versions $old_version lt 1.5.0-1; then remove_old_config fi fi # Configure the 'ledgersmb' system user. getent passwd ledgersmb >/dev/null 2>&1 || adduser --system --group --quiet --disabled-password --home /var/run/ledgersmb --gecos "LedgerSMB" ledgersmb ;; abort-upgrade|upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. # Automatically added by dh_installinit/13.10 if [ "$1" = "install" ] && [ -n "$2" ] && [ -e "/etc/init.d/ledgersmb" ] ; then chmod +x "/etc/init.d/ledgersmb" >/dev/null || true fi # End automatically added section exit 0