postinst is in cipux-cat-web 3.4.0.3-4.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 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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #!/bin/sh
set -e
. /usr/share/debconf/confmodule
pkg=cipux-cat-web
daemon_reconfigure() {
daemon="$1"
action="$2"
cfgdir="/etc/$pkg"
cfgfile="$cfgdir/$daemon.conf"
case "$daemon" in
apache*)
cfgfile="$cfgdir/apache.conf"
symlinkdir="/etc/$daemon/conf.d"
symlink="$symlinkdir/$pkg"
mod_enable="/usr/sbin/a2enmod"
mod_disable="/usr/sbin/a2dismod"
modules_required="alias cgi rewrite"
;;
lighttpd)
symlinkdir="/etc/$daemon/conf-available"
symlink="$symlinkdir/50-$pkg.conf"
mod_enable="/usr/sbin/lighty-enable-mod"
mod_disable="/usr/sbin/lighty-disable-mod"
modules_provided="$pkg"
# modules_required="cgi redirect"
modules_required="cgi"
;;
*)
echo 1>&2 "Warning: unknown daemon \"$daemon\", skipping reconfiguration"
return 1
;;
esac
if [ ! -d "$symlinkdir" ]; then
echo 1>&2 "Warning: $daemon configpath missing, skipping reconfiguration"
return 1
fi
case "$action" in
enable)
if [ ! -e "$symlink" ]; then
ln -s "$cfgfile" "$symlink"
elif [ "$cfgfile" != "$(readlink "$symlink")" ]; then
echo 1>&2 "Warning: $pkg config for $daemon was customized, please remove $symlink and reconfigure $pkg if that customization is unwanted, skipping reconfiguration"
return 1
fi
if [ -n "$mod_enable" ] && [ -n "$modules_required$modules_provided" ]; then
if [ -x "$mod_enable" ] ; then
for module in $modules_required $modules_provided; do
"$mod_enable" "$module"
done
else
echo 1>&2 "Warning: $daemon not installed, $pkg config added but not enabled"
fi
fi
;;
disable)
if [ -n "$mod_disable" ] && [ -n "$modules_provided" ]; then
if [ -x "$mod_disable" ]; then
for module in $modules_provided; do
"$mod_disable" "$module"
done
else
echo 1>&2 "Warning: $daemon not installed, $pkg config will be removed without first getting disabled"
fi
fi
if [ -n "$mod_disable" ] && [ -n "$modules_required" ]; then
echo 1>&2 "Warning: $daemon module(s) $modules_required possibly enabled by $pkg was not disabled (might still be needed), please disable manually if unused"
fi
if [ -e "$symlink" ]; then
if [ "$cfgfile" = "$(readlink "$symlink")" ]; then
rm -f "$symlink"
else
echo 1>&2 "Warning: $pkg config for $daemon was customized, please remove $symlink manually if unwanted"
fi
fi
;;
*)
echo 1>&2 "Error: unknown action \"$action\", script is broken!"
exit 1
;;
esac
}
case "$1" in
configure)
db_get "$pkg/reconfigure-webserver" || true
# Sanitize input (strip commas and ensure safe used as filename)
webservers_selected="$(echo "$RET" | perl -pe 's/[^a-z0-9\+\-\.]+/ /g')"
webservers_preconfigured="$(find "/var/lib/$pkg/dpkg" -type f -printf '%f\n')"
webservers_reconfigured=""
for webserver in $webservers_selected; do
if daemon_reconfigure "$webserver" enable; then
webservers_reconfigured="$webservers_reconfigured $webserver"
touch "/var/lib/$pkg/dpkg/$webserver"
fi
done
for webserver in $webservers_preconfigured; do
if echo "$webservers_selected" | egrep -qv "\b$webserver\b"; then
if daemon_reconfigure "$webserver" disable; then
webservers_reconfigured="$webservers_reconfigured $webserver"
else
echo 1>&2 "Error: failed disabling $pkg config from webserver $webserver"
fi
rm -f "/var/lib/$pkg/dpkg/$webserver"
fi
done
db_get "$pkg/restart-webserver" || true
res="$RET"
db_stop || true
if [ "$res" = "true" ]; then
for webserver in $webservers_reconfigured; do
if [ -x /etc/init.d/$webserver ]; then
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d $webserver restart
else
/etc/init.d/$webserver restart
fi
fi
done
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0
|