preinst is in cacti 0.8.7i-2ubuntu1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 | #!/bin/sh
set -e
# this is where rrd's used to go
oldrradir="/var/cache/cacti"
# this is where rrd's should go, according to policy
newrradir="/var/lib/cacti/rra"
# this used to be a symlink, and needs to be removed before unpacking
oldlink="/usr/share/cacti/site/scripts"
# and this is where it used to point
oldlinkdir="/usr/share/cacti/scripts"
if [ "$1" = "install" -o "$1" = "upgrade" ]; then
# check for pre-existing rrd's in and move them to where they should be
if [ "`ls $oldrradir 2>/dev/null`" ]; then
mkdir -m 755 -p "$newrradir" || true
cp -pR ${oldrradir}/* ${newrradir}/
rm -rf ${oldrradir}
chown -R www-data:www-data "$newrradir"
fi
if [ -L "$oldlink" ]; then
rm -f "$oldlink"
fi
if [ -d "$oldlinkdir" ]; then
rmdir "$oldlinkdir" || true
fi
fi
|