Jonathan Nieder wrote: > As described at [1], apache's scheme for supporting webapps has > changed a little. [2] describes what we need to do.
Here's a start. Thoughts welcome, as always.
From: Jonathan Nieder <jrnie...@gmail.com> Date: Thu, 2 Jan 2014 16:22:17 -0800 Subject: debian/gitweb: adapt packaging for apache 2.4 Try to support both apache 2.2 and 2.4, following advice from https://lists.debian.org/debian-devel-announce/2012/03/msg00013.html https://lists.debian.org/debian-webapps/2012/03/msg00007.html NEEDSWORK: - prerm deconfigure does not clean up as much as it should - needs triggers to reconfigure when apache is updated? - untested Signed-off-by: Jonathan Nieder <jrnie...@gmail.com> --- debian/changelog | 29 +++++++++++++++++++++++++++ debian/control | 1 + debian/gitweb.conffiles | 2 +- debian/gitweb.postinst | 53 +++++++++++++++++++++++++++++++------------------ debian/gitweb.postrm | 21 ++++++++++++++++++++ debian/gitweb.preinst | 6 ++++++ debian/rules | 4 ++-- 7 files changed, 94 insertions(+), 22 deletions(-) create mode 100644 debian/gitweb.postrm create mode 100644 debian/gitweb.preinst diff --git a/debian/changelog b/debian/changelog index 4ffa62c..2c2004f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,32 @@ +git (1:1.8.5.2-1.1) unstable; urgency=low + + * update gitweb configuration packaging for apache 2.4 + (closes: #669292). + * rules, gitweb.conffiles: gitweb's Apache settings go in + /etc/apache2/conf-available, with .conf extension. + * gitweb.preinst, gitweb.postinst, gitweb.postrm: use + dpkg-maintscript-helper to rename + /etc/apache2/conf.d/gitweb -> conf-available/gitweb.conf, + preserving local changes. + * control: Pre-Depends: dpkg (>= 1.15.8) for + dpkg-maintscript-helper. + * gitweb.postinst configure: use apache2-maintscript-helper + if present to enable gitweb configuration. If + apache2-maintscript-helper is not available and + apache2.2-common is unpacked, install a symlink + conf.d/gitweb.conf -> ../conf-available/gitweb.conf for use + by apache 2.2. + * gitweb.postinst configure: only use the apache2 init script + to reload configuration when apache2-maintscript-helper is + unavailable (otherwise, "apache2_invoke enconf gitweb" + takes care of that). + * gitweb.postrm remove, purge: use apache2-maintscript-helper + if present to disable gitweb configuration. + * gitweb.postrm remove, purge: remove conf.d/gitweb.conf -> + ../conf-available/gitweb.conf symlink if still present. + + -- Jonathan Nieder <jrnie...@gmail.com> Thu, 02 Jan 2014 16:22:12 -0800 + git (1:1.8.5.2-1) unstable; urgency=low * new upstream point release. diff --git a/debian/control b/debian/control index aa180bb..da95ec3 100644 --- a/debian/control +++ b/debian/control @@ -353,6 +353,7 @@ Architecture: all Multi-Arch: foreign Depends: git (>> ${source:Upstream-Version}), git (<< ${source:Upstream-Version}-.), perl, apache2 | httpd | lynx-cur +Pre-Depends: dpkg (>= 1.15.8~) Recommends: libhttp-date-perl | libtime-modules-perl Suggests: httpd-cgi | libcgi-fast-perl, git-doc Description: fast, scalable, distributed revision control system (web interface) diff --git a/debian/gitweb.conffiles b/debian/gitweb.conffiles index 27a8287..8947bf6 100644 --- a/debian/gitweb.conffiles +++ b/debian/gitweb.conffiles @@ -1,2 +1,2 @@ /etc/gitweb.conf -/etc/apache2/conf.d/gitweb +/etc/apache2/conf-available/gitweb.conf diff --git a/debian/gitweb.postinst b/debian/gitweb.postinst index b51381b..35f082a 100755 --- a/debian/gitweb.postinst +++ b/debian/gitweb.postinst @@ -1,24 +1,39 @@ #!/bin/sh set -e -case "$1" in - configure) - if [ -x /etc/init.d/apache2 ] - then - if which /usr/sbin/invoke-rc.d >/dev/null 2>&1 - then - invoke-rc.d apache2 reload || true - else - /etc/init.d/apache2 reload || true - fi - fi - ;; +dpkg-maintscript-helper mv_conffile \ + /etc/apache2/conf.d/gitweb /etc/apache2/conf-available/gitweb.conf \ + 1:1.8.5.2-1.1~ -- "$@" - abort-upgrade|abort-remove|abort-deconfigure) - ;; +test "$1" = configure || exit 0 - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac +# <4f6ef77f.6080...@toell.net> +if [ -e /usr/share/apache2/apache2-maintscript-helper ] +then + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke enconf gitweb || exit +else + apache2_common_state=$( + dpkg-query -f '${Status}' -W apache2.2-common 2>/dev/null | + awk '{print $3}' || true + ) + if [ "$apache2_common_state" = installed ] || + [ "$apache2_common_state" = unpacked ] + then + if [ -d /etc/apache2/conf.d/ ] && + [ ! -L /etc/apache2/conf.d/gitweb.conf ] + then + ln -s ../conf-available/gitweb.conf /etc/apache2/conf.d/gitweb.conf + fi + fi + + if [ -x /etc/init.d/apache2 ] + then + if which /usr/sbin/invoke-rc.d >/dev/null 2>&1 + then + invoke-rc.d apache2 reload || true + else + /etc/init.d/apache2 reload || true + fi + fi +fi diff --git a/debian/gitweb.postrm b/debian/gitweb.postrm new file mode 100644 index 0000000..0944c99 --- /dev/null +++ b/debian/gitweb.postrm @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +dpkg-maintscript-helper mv_conffile \ + /etc/apache2/conf.d/gitweb /etc/apache2/conf-available/gitweb.conf \ + 1:1.8.5.2-1.1~ -- "$@" + +test "$1" = remove || test "$1" = purge || exit 0 + +if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke disconf gitweb || exit +elif + +if [ -d /etc/apache2/conf.d ] && + [ -L /etc/apache2/conf.d/gitweb.conf ] && + [ "$(readlink /etc/apache2/conf.d/gitweb.conf)" = \ + ../conf-available/gitweb.conf ] +then + rm -f /etc/apache2/conf.d/gitweb.conf +fi diff --git a/debian/gitweb.preinst b/debian/gitweb.preinst new file mode 100644 index 0000000..f65e722 --- /dev/null +++ b/debian/gitweb.preinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +dpkg-maintscript-helper mv_conffile \ + /etc/apache2/conf.d/gitweb /etc/apache2/conf-available/gitweb.conf \ + 1:1.8.5.2-1.1~ -- "$@" diff --git a/debian/rules b/debian/rules index 5c2a9be..0227853 100755 --- a/debian/rules +++ b/debian/rules @@ -350,9 +350,9 @@ install-indep: build-arch-stamp build-indep-stamp '$(GIT)'web/usr/lib/cgi-bin/gitweb.cgi install -d -m0755 '$(GIT)'web/etc install -m0644 debian/gitweb.conf '$(GIT)'web/etc/gitweb.conf - install -d -m0755 '$(GIT)'web/etc/apache2/conf.d + install -d -m0755 '$(GIT)'web/etc/apache2/conf-available install -m0644 debian/gitweb.apache2.conf \ - '$(GIT)'web/etc/apache2/conf.d/gitweb + '$(GIT)'web/etc/apache2/conf-available/gitweb.conf # git-all rm -rf '$(GIT)'-all install -d -m0755 '$(GIT)'-all -- 1.8.5.1