This file is indexed.

postrm 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

if [ -f /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule
fi

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
    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
	;;
    remove)
	# Handling web server reconfiguration
	webservers_preconfigured="$(find "/var/lib/$pkg/dpkg" -type f -printf '%f\n')"
	webservers_reconfigured=""

	for webserver in $webservers_preconfigured; do
		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"
        done

	db_get "$pkg/restart-webserver"
	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 force-reload
				else
					etc/init.d/$webserver force-reload
				fi
			fi
		done
	fi
	;;
    purge)
	;;
    *)
	echo "postrm called with unknown argument \`$1'" >&2
	exit 1
	;;
esac

# Automatically added by dh_installdebconf
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule
	db_purge
fi
# End automatically added section


exit 0