Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apache 2.4 support for automatic setup #39

Closed
Reiner030 opened this issue Sep 26, 2015 · 2 comments
Closed

Apache 2.4 support for automatic setup #39

Reiner030 opened this issue Sep 26, 2015 · 2 comments

Comments

@Reiner030
Copy link

Debian 8/Jessie and Ubuntu 14/Trusty use Apache 2.4 which has not /etc/apache2/conf.d anymore but /etc/apache2/conf-available and /etc/apache2/conf-enabled which is not recognized by Debian package installer (and I gutes other distros, too)

@Reiner030
Copy link
Author

I found in phpmyadmin package these nice script snippets for lighthttpd and apache2.4 which both have now an conf-available folder:

postinst:

lighttpd_install() {
        if [ ! -f /etc/lighttpd/conf-available/50-phpmyadmin.conf ] ; then
                if which lighty-enable-mod >/dev/null 2>&1 ; then
                        ln -s ../../phpmyadmin/lighttpd.conf /etc/lighttpd/conf-available/50-phpmyadmin.conf
                        # We also need auth to protect setup.php
                        lighty-enable-mod phpmyadmin auth fastcgi fastcgi-php
                        avahi_install
                        desktop_install
                else
                        echo "Lighttpd not installed, skipping"
                fi
        fi
}

apache_install() {
        mkdir -p /etc/apache2/conf-available
        ln -sf ../../phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

        COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)

        if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
                . /usr/share/apache2/apache2-maintscript-helper
                apache2_invoke enconf phpmyadmin
        elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
                [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/phpmyadmin.conf ] && ln -s ../conf-available/phpmyadmin.conf /etc/apache2/conf.d/phpmyadmin.conf
        fi

        avahi_install
        desktop_install
}

postrm

lighttpd_remove() {
        if [ -f /etc/lighttpd/conf-available/50-phpmyadmin.conf ] ; then
                rm -f /etc/lighttpd/conf-available/50-phpmyadmin.conf
                if which lighty-enable-mod >/dev/null 2>&1 ; then
                        lighty-disable-mod phpmyadmin
                        # We also enabled auth in postinst, but I think it's safer to keep it there
                else
                        echo "Lighttpd not installed, skipping"
                fi
                # See bug #448682
                if [ -h /etc/lighttpd/conf-enabled/50-phpmyadmin.conf ] ; then
                    echo 'Manually deleting lighttpd/phpMyAdmin configuration link'
                    rm /etc/lighttpd/conf-enabled/50-phpmyadmin.conf
                fi
        fi
}

apache_remove() {
        COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)

        if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
                . /usr/share/apache2/apache2-maintscript-helper
                apache2_invoke disconf phpmyadmin
        elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
                rm -f /etc/apache2/conf.d/phpmyadmin.conf
        fi

        rm -f /etc/apache2/conf-available/phpmyadmin.conf
}

@aureq
Copy link
Contributor

aureq commented Feb 27, 2016

@Reiner030 Thanks for the code. #42 has been closed and embeds one configuration file for both Apache 2.2 and 2.4. This should work out of the box now.

@aureq aureq closed this as completed Feb 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants