#!/bin/sh -e
# prerm script for perforce-swarm
#
# see: dh_installdeb(1)
# 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
ME="${0##*/}"
#echo "###########################"
#echo "[$ME] [$*]"
THISPKG="helix-swarm"
PERFORCE_ROOT="/opt/perforce"
PERFORCE_CFGDIR="$PERFORCE_ROOT/etc"
SWARM_ROOT="$PERFORCE_ROOT/swarm"
SWARM_DATADIR="$SWARM_ROOT/data"
SWARM_SBINDIR="$SWARM_ROOT/sbin"
SWARM_CONFIG="$SWARM_DATADIR/config.php"
APACHE_SITESDIR="/etc/apache2/sites-available"
SWARM_VHOST="$APACHE_SITESDIR/perforce-swarm-site.conf"
APACHE_USER="www-data"
APACHE_GROUP="$APACHE_USER"
CRON_DIR="/etc/cron.d"
CRON_SCRIPT="$CRON_DIR/helix-swarm"
CRON_CONFIG="$PERFORCE_CFGDIR/swarm-cron-hosts.conf"
PHPINI_DIR="/etc/php5/conf.d"
P4PHP_INI="${PHPINI_DIR}/perforce.ini"
do_remove()
{
echo "$THISPKG: Disabling the Swarm Apache site..."
a2dissite perforce-swarm-site.conf || true
echo "$THISPKG: Disabling P4PHP extension..."
mv "$P4PHP_INI" "$P4PHP_INI.save" || true
echo "$THISPKG: Restarting Apache to unload P4PHP and stop Swarm workers..."
service apache2 restart
echo "$THISPKG: Disabling Swarm cron hosts config..."
mv "$CRON_CONFIG" "$CRON_CONFIG.save" || true
echo "$THISPKG: Disabling cronfile..."
rm "$CRON_SCRIPT" || true
}
case "$1" in
remove|deconfigure)
do_remove
;;
upgrade)
# Remove errant 'perforce-swarm' cronfile, if it exists (SW-2727)
if [ -f "$CRON_DIR/perforce-swarm" ]; then
rm "$CRON_DIR/perforce-swarm"
fi
;;
failed-upgrade)
;;
*)
echo "$ME 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
# |
Change |
User |
Description |
Committed |
|
#1
|
18730 |
Liz Lam |
clean up code and move things around |
|
|