postrm is in cardstories 1.0.6-1.3ubuntu1.
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 | #!/bin/sh -e
#
# Copyright (C) 2011 Dachary <loic@dachary.org>
#
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute and/or modify this program under the terms of
# the GNU Affero General Public License (AGPL) as published by the Free
# Software Foundation (FSF), either version 3 of the License, or (at your
# option) any later version of the AGPL published by the FSF.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program in a file in the toplevel directory called
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
#
nginx_remove() {
included=/usr/share/cardstories/conf/nginx.conf
conf=/etc/nginx/sites-available/default
if [ -f $conf ] && grep $included $conf > /dev/null ; then
perl -ni -e "print if(!m:$included:)" $conf
fi
}
apache2_remove() {
conf=/etc/apache2/config.d/cardstories.conf
rm -rf $conf
}
if [ -f /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
fi
if [ "$1" = "purge" ]; then
if id -u cardstories >/dev/null 2>&1; then
userdel cardstories
fi
rm -Rf /var/lib/cardstories /var/log/cardstories /etc/cardstories
fi
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
if [ -f /usr/share/debconf/confmodule ]; then
db_version 2.0
db_get cardstories/reconfigure-webserver
webservers="$RET"
for webserver in $webservers; do
webserver=${webserver%,}
if [ "$webserver" = "nginx" ] ; then
nginx_remove
elif [ "$webserver" = "apache2" ] ; then
apache2_remove
fi
# Redirection of 3 is needed because Debconf uses it and it might
# be inherited by webserver. See bug #446324.
if [ -f /etc/init.d/$webserver ] ; then
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $webserver restart 3>/dev/null || true
else
/etc/init.d/$webserver restart 3>/dev/null || true
fi
fi
done
fi
fi
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d cardstories remove >/dev/null
fi
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
if [ -d /run/systemd/system ] ; then
systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# 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
|