Hello, Here is a new version of the patch, with following changes: - I now ship /etc/ola in both ola & ola-rdm-tests packages, since they both need it and I don't want to make ola-rdm-tests pre-depend on ola just to ensure /etc/ola exists when installing ola-rdm-tests. Andreas, I tried at first to ship /etc/ola within the package, but piuparts tests failed. Thought it was due to that change, but I now realize this was because of upgrade-tests instead. - Removed useless comments to reduce patch size - Fix typo in changelog (damn me)
Helmut, for now I still manage /etc/default/ola. As explained, I consider it as important so that users don't have to dig into init script to know which value they have to put into it to start olad service. Please just let me know if you still disagree so that I can remove it. As usual (sounds strange to me since it's my first real patch, but still), piuparts tests successfully pass (always with --no-upgrade-test flag) Job is not yet fully done, but I already wanted to deeply thank you for your patience and your advices. I'm learning a lot of things from you (and I enjoy it :p) Regards, Jean Baptiste On 19/11/2014 12:32, Andreas Beckmann wrote: > On 2014-11-19 07:41, Helmut Grohne wrote: >> * "rm -rf /etc/ola" is dangerous and can potentially delete too much. I >> suggest to use "rmdir --ignore-fail-on-non-empty" if that makes the >> package purge cleanly as well. > What about shipping the directory (potentially empty) and let dpkg do > the rmdir? > Then just delete the files in there your maintainer scripts placed. > piuparts may complain that the *owned* directory is left after purge - > that would be dpkg's fault not to retry the rmdir after the postrm purge > was run. This does not need to be worked around. dpkg will be fixed > eventually (for jessie +x) >> * I suggest to remove the summary comments from the new scripts to >> reduce the size of your patch. > Andreas
diff -Nru ola-0.9.1/debian/changelog ola-0.9.1/debian/changelog --- ola-0.9.1/debian/changelog 2014-08-17 10:07:29.000000000 +0200 +++ ola-0.9.1/debian/changelog 2014-11-19 13:45:05.000000000 +0100 @@ -1,3 +1,18 @@ +ola (0.9.1-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Remove debconf calls from ola-rdm-tests postinst. (Closes: #767676) + * Fix other serious issues: + - Ship /etc/ola within package (wasn't deleted before on purge) + - Provides missing /etc/default/ola from ola postinst script to allow + olad service control in the same way rdm_test_server is + - Update init scripts to change advice to enable olad & drm_test_server + services (dpkg-reconfigure won't work without debconf) + - add postrm scripts for packages ola & ola-rdm-tests to fully remove + configuration files so that piuparts tests can pass + + -- Jean Baptiste Favre <deb...@jbfavre.org> Sun, 16 Nov 2014 17:44:18 +0100 + ola (0.9.1-1) unstable; urgency=low * New upstream release diff -Nru ola-0.9.1/debian/ola.dirs ola-0.9.1/debian/ola.dirs --- ola-0.9.1/debian/ola.dirs 2014-04-21 08:19:26.000000000 +0200 +++ ola-0.9.1/debian/ola.dirs 2014-11-19 13:06:54.000000000 +0100 @@ -1,3 +1,4 @@ +etc/ola usr/bin usr/lib usr/share/olad/www diff -Nru ola-0.9.1/debian/ola.olad.init ola-0.9.1/debian/ola.olad.init --- ola-0.9.1/debian/ola.olad.init 2014-08-17 09:17:40.000000000 +0200 +++ ola-0.9.1/debian/ola.olad.init 2014-11-18 14:04:41.000000000 +0100 @@ -23,7 +23,7 @@ if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then DAEMON_ARGS="--syslog --log-level 3 --config-dir /etc/ola" elif [ "$1" = "start" ] || [ "$1" = "stop" ] ; then - echo "The init script is currently inactive;\nuse \"dpkg-reconfigure ola\" to change this." >&2 + echo "The init script is currently inactive;\nPlease update \"/etc/default/ola\" to change this." >&2 fi [ -x "$DAEMON" ] || exit 0 diff -Nru ola-0.9.1/debian/ola.postinst ola-0.9.1/debian/ola.postinst --- ola-0.9.1/debian/ola.postinst 2014-08-17 09:17:40.000000000 +0200 +++ ola-0.9.1/debian/ola.postinst 2014-11-19 13:40:58.000000000 +0100 @@ -8,13 +8,19 @@ groups olad | grep plugdev > /dev/null || adduser olad plugdev # setup the config dir -CONF_DIR=/etc/ola -if [ ! -d ${CONF_DIR} ]; then - mkdir -p ${CONF_DIR}; - chown -R olad:olad ${CONF_DIR}; - chmod g+s ${CONF_DIR}; -fi; +chown -R olad:olad /etc/ola; +chmod g+s /etc/ola; +conffile="/etc/default/ola" + +if [ -f $conffile ] ; then + sed -i -e 's/^[ ]*DAEMON/RUN_DAEMON/g' $conffile +else + cat << EOF > $conffile +# If set to true, olad will run. +RUN_DAEMON="true" +EOF +fi # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. diff -Nru ola-0.9.1/debian/ola.postrm ola-0.9.1/debian/ola.postrm --- ola-0.9.1/debian/ola.postrm 1970-01-01 01:00:00.000000000 +0100 +++ ola-0.9.1/debian/ola.postrm 2014-11-19 13:39:49.000000000 +0100 @@ -0,0 +1,25 @@ +#!/bin/sh +# postrm script for ola + +set -e + +case "$1" in + purge) + if [ -f /etc/default/ola ]; then + rm -f /etc/default/ola + fi + ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff -Nru ola-0.9.1/debian/ola-rdm-tests.dirs ola-0.9.1/debian/ola-rdm-tests.dirs --- ola-0.9.1/debian/ola-rdm-tests.dirs 2014-04-21 08:19:26.000000000 +0200 +++ ola-0.9.1/debian/ola-rdm-tests.dirs 2014-11-19 13:07:12.000000000 +0100 @@ -1,3 +1,4 @@ +etc/ola usr/bin usr/lib usr/share diff -Nru ola-0.9.1/debian/ola-rdm-tests.postinst ola-0.9.1/debian/ola-rdm-tests.postinst --- ola-0.9.1/debian/ola-rdm-tests.postinst 2014-04-21 08:19:26.000000000 +0200 +++ ola-0.9.1/debian/ola-rdm-tests.postinst 2014-11-18 14:04:41.000000000 +0100 @@ -3,34 +3,12 @@ conffile="/etc/default/ola-rdm-tests" -update_config_file() { - db_field=$1 - config_field=$2 - - RET=false - db_get $db_field - if [ -n "$RET" ] ; then - if grep -q "^$config_field" $conffile ; then - # keep any admin changes, while replacing the variable content - sed "s/^[ ]*$config_field=\".*\"/$config_field=\"$RET\"/" < $conffile > $conffile.new && - mv $conffile.new $conffile - else - echo "$config_field=\"$RET\"" >> $conffile - fi - fi -} - -# Source debconf library -- we have a Depends line -# to make sure it is there... -. /usr/share/debconf/confmodule -db_version 2.0 - case "$1" in configure) - if [ -f $conffile ] ; then - sed -i -e 's/^[ ]*DAEMON/RUN_DAEMON/g' $conffile - else - cat << EOF > $conffile + if [ -f $conffile ] ; then + sed -i -e 's/^[ ]*DAEMON/RUN_DAEMON/g' $conffile + else + cat << EOF > $conffile # Defaults for ola-rdm-tests initscript (/etc/init.d/ola-rdm-tests) # This is a POSIX shell fragment @@ -39,11 +17,7 @@ # ola-rdm-tests daemon switch. If set to true, rdm_test_server.py will run. RUN_DAEMON="true" EOF - fi - - update_config_file ola-rdm-tests/daemon RUN_DAEMON - - db_stop + fi ;; abort-upgrade|abort-remove|abort-deconfigure) diff -Nru ola-0.9.1/debian/ola-rdm-tests.postrm ola-0.9.1/debian/ola-rdm-tests.postrm --- ola-0.9.1/debian/ola-rdm-tests.postrm 1970-01-01 01:00:00.000000000 +0100 +++ ola-0.9.1/debian/ola-rdm-tests.postrm 2014-11-19 13:40:03.000000000 +0100 @@ -0,0 +1,25 @@ +#!/bin/sh +# postrm script for ola-rdm-tests + +set -e + +case "$1" in + purge) + if [ -f /etc/default/ola-rdm-tests ]; then + rm -f /etc/default/ola-rdm-tests + fi + ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff -Nru ola-0.9.1/debian/ola-rdm-tests.rdm_test_server.init ola-0.9.1/debian/ola-rdm-tests.rdm_test_server.init --- ola-0.9.1/debian/ola-rdm-tests.rdm_test_server.init 2014-08-17 09:17:40.000000000 +0200 +++ ola-0.9.1/debian/ola-rdm-tests.rdm_test_server.init 2014-11-18 14:04:41.000000000 +0100 @@ -24,7 +24,7 @@ if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then DAEMON_ARGS="--world-writeable" elif [ "$1" = "start" ] || [ "$1" = "stop" ] ; then - echo "The init script is currently inactive;\nuse \"dpkg-reconfigure ola-rdm-tests\" to change this." >&2 + echo "The init script is currently inactive;\nPlease update \"/etc/default/ola-rdm-tests\" to change this." >&2 fi [ -x "$DAEMON" ] || exit 0