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