From a8c22829d8e8845cd4ddf4ef8b61a1ed79edfffc Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Mon, 12 Mar 2018 22:57:42 +0100 Subject: Imported from the SVN repository http://svn.wolffelaar.nl/wsvn/phpbb/branches/jessie/ Signed-off-by: Olivier Gayot --- debian/webapps-config | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 debian/webapps-config (limited to 'debian/webapps-config') diff --git a/debian/webapps-config b/debian/webapps-config new file mode 100644 index 0000000..d9b0266 --- /dev/null +++ b/debian/webapps-config @@ -0,0 +1,132 @@ +# some library functions for phpbb3 maintainer scripts +# copyright 2010 J.M. Roth + +get_webserver_configdata () { + local package=$1 + local webserver=$2 + local prio=$3 + + case "$webserver" in + "lighttpd" ) + confdir=conf-available + wfile=${prio}-$package.conf + ;; + "apache2" ) + confdir=conf-available + wfile=$package.conf + ;; + * ) + echo "$0 $@: webserver $webserver is not supported." 1>&2 + return 1 + ;; + esac +} + +# picked up from https://wiki.debian.org/Apache/PackagingFor24#Making_web_applications_compatible_to_both.2C_Apache_2.2_and_2.4 +COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) +APACHE2_MAINTSCRIPT_METHOD=$1 +APACHE2_MAINTSCRIPT_ARGUMENT=$2 + +install_webserver_config () { + local package=$1 + local webserver=$2 + local prio=$3 + + get_webserver_configdata $@ || return 1 + # yields: $confdir, $wfile + + if [ -d /etc/$webserver/$confdir ] && [ ! -L /etc/$webserver/$confdir/$wfile ] ; then + if [ ! -x /usr/sbin/$webserver ] ; then + echo "$0 $@: webserver $webserver not found, skipping" 1>&2 + else + ln -s ../../$package/$webserver.conf /etc/$webserver/$confdir/$wfile + if [ "$webserver" = "lighttpd" ] ; then + lighty-enable-mod $package >/dev/null + elif [ "$webserver" = "apache2" ] ; then + if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke enconf $package + elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then + [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/$package.conf ] && ln -s ../conf-available/$package.conf /etc/apache2/conf.d/$package.conf + fi + fi + fi + fi +} + +_purge_webserver_config () { + local package=$1 + local webserver=$2 + local prio=$3 + + get_webserver_configdata $@ || return 0 + # yields: $confdir, $wfile + + if [ -d /etc/$webserver/$confdir ] && [ -L /etc/$webserver/$confdir/$wfile ] ; then + if [ ! -x /usr/sbin/$webserver ] ; then + echo "$0 $@: webserver $webserver not installed, skipping" 1>&2 + else + if [ "$webserver" = "lighttpd" ] ; then + lighty-disable-mod $package >/dev/null + elif [ "$webserver" = "apache2" ] ; then + if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke disconf $package + elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then + [ -L /etc/apache2/conf.d/$package.conf ] && rm /etc/apache2/conf.d/$package.conf + fi + fi + rm /etc/$webserver/$confdir/$wfile + fi + fi +} + +purge_webserver_config () { + local package=$1 + local webserver=$2 + local prio=$3 + + case "$webserver" in + "all" ) + db_metaget $package/httpd Choices + for w in $RET ; do + _purge_webserver_config $package ${w%,} $prio + done + ;; + * ) + _purge_webserver_config $@ + ;; + esac +} + +_reload_webserver () { + local webserver=$1 + + if [ -x /usr/sbin/$webserver ]; then + # Redirection of fd 3 is needed because Debconf uses it and it might + # be inherited by webserver. See bug #446324. + if [ -x /usr/sbin/invoke-rc.d ]; then + invoke-rc.d $webserver reload 3>/dev/null || true + else + /etc/init.d/$webserver reload 3>/dev/null || true + fi + echo + fi +} + +reload_webserver () { + local package=$1 + local webserver=$2 + + case "$webserver" in + "all" ) + db_metaget $package/httpd Choices + for w in $RET ; do + _reload_webserver ${w%,} + done + ;; + * ) + _reload_webserver ${webserver%,} + ;; + esac +} -- cgit v1.2.3