postinst is in torrentflux 2.4-5.1.
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 | #!/bin/sh
set -e
#set -x
. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postinst.mysql
dbc_generate_include=php:/etc/torrentflux/config-db.php
dbc_go torrentflux $@
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
case "$1" in
configure)
chown root:www-data /etc/torrentflux/config-db.php
chmod 640 /etc/torrentflux/config-db.php
# Remove a bad directory created by 2.3-8
if [ -f /etc/torrentlfux/lighttpd.conf ]; then
echo "Deleting improperly named /etc/torrentlfux directory"
rm -f /etc/torrentlfux/lighttpd.conf
rmdir --ignore-fail-on-non-empty /etc/torrentlfux
fi
# Webservers to test for
webservers="apache apache-ssl apache-perl apache2"
restart=""
found="false"
for webserver in $webservers; do
webserver=${webserver%,}
# Test for the webserver
test -x /usr/sbin/$webserver || continue
test -d /etc/$webserver/conf.d || continue
# Create link to config snippet
if [ ! -f /etc/$webserver/conf.d/torrentflux.conf ] && [ ! -h /etc/$webserver/conf.d/torrentflux.conf ]; then
ln -s /etc/torrentflux/apache.conf /etc/$webserver/conf.d/torrentflux.conf
fi
# Prompt for restarting the webserver
found="true"
db_reset torrentflux/restart-webserver || true
db_subst torrentflux/restart-webserver webserver "$webserver"
db_input high torrentflux/restart-webserver || true
db_go
db_get torrentflux/restart-webserver
if [ "$RET" = "true" ]; then
restart="$restart $webserver"
fi
done
if [ "$found" = "false" ] ; then
db_input high torrentflux/unsupported-webserver || true
db_go
fi
# Tell debconf to stop so it doesn't get confused
db_stop
for webserver in $restart; do
webserver=${webserver%,}
# Restart the webserver
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $webserver restart >&2
else
/etc/init.d/$webserver restart >&2
fi
done
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0
|