[Pkg-javascript-commits] [SCM] javascript-common branch, master, updated. 7-22-g2d7cc38
Jean-Michel Vourgère
jmv_deb at nirgal.com
Sun Jul 28 22:22:01 UTC 2013
The following commit has been merged in the master branch:
commit e4e641d4141847626c8ba07396adf918f3e8da8d
Author: Jean-Michel Vourgère <jmv_deb at nirgal.com>
Date: Sat Jul 20 23:14:01 2013 +0200
No longer re-enable on reconfigure lighttpd
See README.lighttpd_removal
diff --git a/debian/README.lighttpd_removal b/debian/README.lighttpd_removal
new file mode 100644
index 0000000..de15b4f
--- /dev/null
+++ b/debian/README.lighttpd_removal
@@ -0,0 +1,34 @@
+This files describes the mechanism used to enable or not lighttpd conf file
+on configure.
+
+Rationale
+=========
+When a package is removed, its links in conf-enabled must be deleted. Not doing
+so will usually result in the use of removed data, and might cause httpd start
+failure.
+Note that in the case of javascript-common, we could have decided to disable
+/javascript on purge rather that on removal, but that would have made package
+usage inconsistent with common practice.
+
+The problem is that the user might disable the module by just deleting the link,
+for example by using lighttpd-disable-mod command.
+We must not recreate that link if that's the case. A missing link should be
+considered as local user configuration choice.
+See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=474913#33
+
+A basic solution might be not to recreate it on updates testing "$2" is empty
+in postinst.
+But then if the package is uninstalled and not purged the information is lost.
+The complete solution consists in storing inside the configuration, meaning in
+/etc, the fact during uninstall, that the link was aleady removed.
+
+Implementation
+==============
+prerm remove|upgrade: If conf-enabled link was removed, create a file
+/etc/javascript-common/lighttpd_disabled_by_user
+
+postinst configure: Enable on fresh installs and old upgrades. On other
+upgrades, check file lighttpd_disabled_by_user to enable or not.
+
+That file is not a conffile, we don't want the user to be bugged during
+upgrades about a change he did not make.
diff --git a/debian/changelog b/debian/changelog
index c8b8a38..2f70732 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,12 +17,14 @@ javascript-common (9) UNRELEASED; urgency=low
. Bumped to compat level 9.
. Adjusted Depends on debhelper >= 9
* Add copyright format version.
- * Only disable in postrm on remove|purge, not on upgrades.
* Changed set up for apache2.4 (Closes: #710475)
. Build-Depends on dh-apache2.
. New debian/apache2 file with dh_apache2 settings.
. Added --with apache2 to debian/rules.
. Changed Suggests: into Recommends: http.
+ * Disable lighttpd conf in prerm remove. Temporarily store the fact that user
+ manually disabled our configuration. In that case, do not reinstall link on
+ configure. See README.lighttpd_removal. (Downgrades #474913)
-- Jean-Michel Vourgère <jmv_deb at nirgal.com> Thu, 18 Jul 2013 20:41:16 +0200
diff --git a/debian/javascript-common.postinst b/debian/javascript-common.postinst
index 72b581f..66283a6 100644
--- a/debian/javascript-common.postinst
+++ b/debian/javascript-common.postinst
@@ -14,15 +14,35 @@ set -e
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
+lighttpd_setup() {
+ mkdir -p /etc/lighttpd/conf-enabled
+ if [ ! -e /etc/lighttpd/conf-enabled/90-javascript-alias.conf ]
+ then
+ ln -s ../conf-available/90-javascript-alias.conf /etc/lighttpd/conf-enabled/90-javascript-alias.conf
+ if which invoke-rc.d > /dev/null && [ -x /etc/init.d/lighttpd ]
+ then
+ invoke-rc.d lighttpd reload || true
+ fi
+ fi
+}
+
+
case "${1}" in
configure)
- mkdir -p /etc/lighttpd/conf-enabled
- if [ ! -e /etc/lighttpd/conf-enabled/90-javascript-alias.conf ]
+ if dpkg --compare-versions "$2" lt 9
then
- ln -s ../conf-available/90-javascript-alias.conf /etc/lighttpd/conf-enabled/90-javascript-alias.conf
- if which invoke-rc.d > /dev/null && [ -x /etc/init.d/lighttpd ]
+ # Fresh install or most-recently-configured-version < 9
+ lighttpd_setup
+ else
+ if [ -e /etc/javascript-common/lighttpd_disabled_by_user ]
then
- invoke-rc.d lighttpd reload || true
+ rm /etc/javascript-common/lighttpd_disabled_by_user
+ rmdir --ignore-fail-on-non-empty /etc/javascript-common
+ # Do not reenable javascript/ in lighttpd
+ echo javascript-alias was disabled in lighttpd. >&2
+ echo Hint: Use \"lighttpd-enable-mod javascript-alias\" to re-enable. >&2
+ else
+ lighttpd_setup
fi
fi
;;
@@ -39,11 +59,14 @@ esac
#DEBHELPER#
# Will make piupart more happy on upgrades
-if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt-nl "9"
+if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt "9"
then
rmdir --ignore-fail-on-non-empty /etc/apache2/conf.d
- # This is a work around bug #584185:
- rmdir --ignore-fail-on-non-empty /etc/javascript-common
+ # This is a work around bug #584185:
+ if [ -d /etc/javascript-common ]
+ then
+ rmdir --ignore-fail-on-non-empty /etc/javascript-common
+ fi
fi
exit 0
diff --git a/debian/javascript-common.postrm b/debian/javascript-common.postrm
index dcce06d..3f64a80 100644
--- a/debian/javascript-common.postrm
+++ b/debian/javascript-common.postrm
@@ -16,22 +16,23 @@ set -e
# the debian-policy package
case "${1}" in
- remove|purge)
- if [ -L /etc/lighttpd/conf-enabled/90-javascript-alias.conf ]
- then
- rm -f /etc/lighttpd/conf-enabled/90-javascript-alias.conf
- if which invoke-rc.d > /dev/null && [ -x /etc/init.d/lighttpd ]
- then
- invoke-rc.d lighttpd reload || true
- fi
- fi
+ purge)
if [ -d /etc/lighttpd/conf-enabled/ ]
then
rmdir --ignore-fail-on-non-empty /etc/lighttpd/conf-enabled/
fi
+ # /etc/javascript-common/lighttpd_disabled_by_user is NOT a conffile:
+ if [ -e /etc/javascript-common/lighttpd_disabled_by_user ]
+ then
+ rm /etc/javascript-common/lighttpd_disabled_by_user
+ fi
+ if [ -d /etc/javascript-common/ ]
+ then
+ rmdir --ignore-fail-on-non-empty /etc/javascript-common/
+ fi
;;
- upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
diff --git a/debian/javascript-common.prerm b/debian/javascript-common.prerm
new file mode 100644
index 0000000..d7d6f0e
--- /dev/null
+++ b/debian/javascript-common.prerm
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+disabled_file_content() {
+ echo << EOS
+This file has been automatically generated by javascript-common during its
+uninstallation in order to keep track that you choose to disabled
+javascript-alias from lighttpd.
+It will disappear if you reinstall javascript-common or if you purge it.
+EOS
+}
+
+
+case "${1}" in
+ remove)
+ # disable our lighttpd conf as soon as possible, hence in prerm
+ if [ -L /etc/lighttpd/conf-enabled/90-javascript-alias.conf ]
+ then
+ rm -f /etc/lighttpd/conf-enabled/90-javascript-alias.conf
+ if which invoke-rc.d > /dev/null && [ -x /etc/init.d/lighttpd ]
+ then
+ invoke-rc.d lighttpd reload || true
+ fi
+ else
+ # Already disabled!
+ # Keep track of conf disabled by user
+ mkdir -p /etc/javascript-common
+ disabled_file_content > /etc/javascript-common/lighttpd_disabled_by_user
+ fi
+ ;;
+ upgrade)
+ if [ ! -L /etc/lighttpd/conf-enabled/90-javascript-alias.conf ]
+ then
+ # Keep track of conf disabled by user
+ mkdir -p /etc/javascript-common
+ disabled_file_content > /etc/javascript-common/lighttpd_disabled_by_user
+ fi
+ ;;
+ failed-upgrade|deconfigure)
+ ;;
+ *)
+ echo "prerm called with unknown argument \`${1}'" >&2
+ exit 1
+ ;;
+esac
+
+
+#DEBHELPER#
+
+exit 0
--
javascript-common
More information about the Pkg-javascript-commits
mailing list