preinst is in fwknop-server 2.6.0-2.2.
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 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 | #!/bin/sh
# This script is only intended to upgrade fwknop from version 1.9.x
# to the new C implementation (2.0.0).
# Some files are not needed anymore or have been renamed in the process.
#
# NB: As some commands can return an exit code other than 0 we do not use
# *set -e* at the beginning.
if [ "$1" = "upgrade" ]; then
status=1;
if [ -x "`which dpkg 2>/dev/null`" ]; then
dpkg --compare-versions 2.0.0 gt $2
status=$?
fi
if [ $status = 0 ]; then
echo -n "Removing old Fwknop files ... "
# Removing old configuration files
file_list="/etc/fwknop/pf.os /etc/fwknop/fwknop.conf"
for f in $file_list; do
rm $f 2>/dev/null
done
# Handle the /var/run/fwknop directory that contains pid and socket
# files
if [ -d /var/run/fwknop ]; then
find /var/run/fwknop/ -type f -exec rm {} \;
find /var/run/fwknop/ -type s -exec rm {} \;
fi
# Handle the /var/log/fwknop directory that contains log files
if [ -d /var/log/fwknop ]; then
find /var/log/fwknop/ -type f -exec rm {} \;
if [ -d /var/log/fwknop/errs ]; then
find /var/log/fwknop/errs/ -type f -exec rm {} \;
rmdir /var/log/fwknop/errs
fi
rmdir /var/log/fwknop
fi
echo "Done."
fi
fi
set -e
exit 0
|