1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#!/bin/sh
#
# Author: Dario Minnucci <debian@midworld.net>
# Date: Tue, 25 Aug 2009 02:52:05 +0200
# Updated by: Ignace Mouzannar <mouzannar@gmail.com>
#
set -e
case "$1" in
configure)
# Copy old user files (if they are present)
# Check archive and images directories
for folder in archive images
do
if [ -d "/usr/lib/iptotal/${folder}" ]; then
# case of update from 0.3.3-10 in which the working
# directory is /usr/lib/iptotal/
for file in `find /usr/lib/iptotal/${folder}/ -maxdepth 1 -type f`
do
cp ${file} /var/lib/iptotal/${folder}
done
# delete files from old directories
rm -f /usr/lib/iptotal/${folder}/*
rm -f /var/www/iptotal/${folder}/*
elif [ -d "/var/www/iptotal/${folder}" ]; then
# case of update from 0.3.3-8 or older in which the working
# directory is /var/www/iptotal/
for file in `find /var/www/iptotal/${folder}/ -maxdepth 1 -type f`
do
cp ${file} /var/lib/iptotal/${folder}
done
# delete files from old directory
rm -f /var/www/iptotal/${folder}/*
fi
done
for file in iptotal.rrd result.txt
do
if [ -f "/usr/lib/iptotal/${file}" ]; then
cp -f /usr/lib/iptotal/${file} /var/lib/iptotal/
rm -f /usr/lib/iptotal/${file}
rm -f /var/www/iptotal/${file}
elif [ -f "/var/www/iptotal/${file}" ]; then
cp -f /var/www/iptotal/${file} /var/lib/iptotal/
rm -f /var/www/iptotal/${file}
fi
done
# change ownership to www-data
chown www-data:www-data /var/lib/iptotal/*
# enable cgi
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enmod cgi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
|