preinst is in squid3 3.1.19-1ubuntu2.
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #! /bin/sh
set -e
case "$1" in
upgrade|install-upgrade)
;;
abort-upgrade)
exit 0
;;
esac
#
# Add the "proxy" user/group to /etc/passwd if needed.
#
if ! grep -q "^proxy:" /etc/passwd
then
#
# Let's hope that this works; if /var/spool/squid3 is
# already present this fails :(
#
adduser --system --home /var/spool/squid3 --group proxy
#
# Change the shell so that cron jobs will work.
# (They run as root now, but you can never know).
#
chsh -s /bin/sh proxy
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_installinit
if [ "$1" = install ] || [ "$1" = upgrade ]; then
if [ -e "/etc/init.d/squid3" ] && [ ! -L "/etc/init.d/squid3" ]; then
if [ "`md5sum \"/etc/init.d/squid3\" | sed -e \"s/ .*//\"`" != \
"`dpkg-query -W -f='${Conffiles}' squid3 | sed -n -e \"\\\\' /etc/init.d/squid3 '{s/ obsolete$//;s/.* //p}\"`" ]
then
echo "Obsolete conffile /etc/init.d/squid3 has been modified by you, renaming to .dpkg-bak"
mv -f "/etc/init.d/squid3" "/etc/init.d/squid3.dpkg-bak"
else
rm -f "/etc/init.d/squid3"
fi
fi
fi
# End automatically added section
# Because of this bug:
# https://bugs.launchpad.net/bugs/573853
# Upstart may have lost track of squid. Correct that by using the
# pid file to stop it and then start the job back up
if [ "$1" = "upgrade" ] \
&& [ -f "/var/run/squid.pid" ] \
&& [ -f "/etc/init/squid3.conf" ]
then
SQUID_PID=`cat /var/run/squid3.pid`
# is this still running, and actually squid
if [ -d "/proc/${SQUID_PID}" ] \
&& [ "`stat -L -c %D%i /proc/${SQUID_PID}/exe`" = "`stat -L -c %D%i /usr/sbin/squid`" ]
then
UPSTART_SQUID_PID=`initctl status squid3 | awk -F'process ' '/start\/running, process / { print $2 }'`
PIDFILE_PPID=`awk '{print $4}' /proc/$SQUID_PID/stat`
# If the user has disabled expect fork the pids will be the same
if [ "$UPSTART_SQUID_PID" != "$SQUID_PID" -a "$PIDFILE_PPID" != "$UPSTART_SQUID_PID" ]
then
# stop the job
if invoke-rc.d squid3 stop
then
# kill the pid file pid
kill ${SQUID_PID}
# start the job again
invoke-rc.d squid3 start
fi
fi
fi
fi
# Automatically added by dh_installinit
if [ "$1" = install ] || [ "$1" = upgrade ]; then
if [ -e "/etc/init.d/squid3" ] && [ ! -L "/etc/init.d/squid3" ]; then
if [ "`md5sum \"/etc/init.d/squid3\" | sed -e \"s/ .*//\"`" != \
"`dpkg-query -W -f='${Conffiles}' squid3 | sed -n -e \"\\\\' /etc/init.d/squid3 '{s/ obsolete$//;s/.* //p}\"`" ]
then
echo "Obsolete conffile /etc/init.d/squid3 has been modified by you, renaming to .dpkg-bak"
mv -f "/etc/init.d/squid3" "/etc/init.d/squid3.dpkg-bak"
else
rm -f "/etc/init.d/squid3"
fi
fi
fi
# End automatically added section
exit 0
|