Re: Standards 4.1.3 and apt-cacher
On Thu, 08 Feb 2018 17:56:28 +, Mark Hindley wrote: > However, in trying to understand more fully when postinst is called with > configure and reconfigure arguments, it appears that reconfigure is not > currently supported at all. It is not mentioned in the Policy and > ancient bug #215549 was closed as wontfix. So although reconfigure is in > the postinst skeleton the distinction is not observed. The only possible > way to distinguish is using the hack that DEBCONF_RECONFIGURE=1 is set > in the postinst environment. See debconf-devel(7). > > Or am I missing something? I don't actually know much about debconf, sorry. I just followed what debhelper is doing, but it appears you need to add that check with DEBCONF_RECONFIGURE, otherwise a dpkg-reconfigure will always be a NOP (because defaults and defaults-disabled become NOPs when the service is already enabled or disabled). Saludos
Re: Re: Standards 4.1.3 and apt-cacher
> It is a bit overzealous, but I think you have another problem. Your package > will override local admin on upgrades (if they changed the config manually) by > calling update-rc.d and update-inetd. I think you need to change it to not do > so. I don't know much about update-inetd but the pattern for update-rc.d > should be something like this: > > > if [ $1 = configure ] || [ $1 == abort-upgrade ] ; then > db_get apt-cacher/mode > case "$RET" in > daemon) > update_rc_args="apt-cacher defaults" > ;; > inetd) > manual) > update_rc_args="apt-cacher defaults-disabled" > ;; > esac > fi > if [ $1 = reconfigure ] ; then > db_get apt-cacher/mode > case "$RET" in > daemon) > update_rc_args="apt-cacher enable" > ;; > inetd) > update_rc_args="apt-cacher disable" > ;; > manual) > update_rc_args="" #do nothing > ;; > esac > fi > if [ -n "$update_rc_args" ] ; then > update-rc.d $update_rc_args > fi Felipe, Many thanks for this. Your point is well made and I have now got a working version that lintian doesn't complain about. However, in trying to understand more fully when postinst is called with configure and reconfigure arguments, it appears that reconfigure is not currently supported at all. It is not mentioned in the Policy and ancient bug #215549 was closed as wontfix. So although reconfigure is in the postinst skeleton the distinction is not observed. The only possible way to distinguish is using the hack that DEBCONF_RECONFIGURE=1 is set in the postinst environment. See debconf-devel(7). Or am I missing something? Mark
Re: Standards 4.1.3 and apt-cacher
Hi, On Wed, 07 Feb 2018 10:14:15 +, Mark Hindley wrote: > Hello, > > I am trying to upgrade apt-cacher to Standards version 4.1.3. In > particular using DISABLED=yes|no in /etc/defaults is now prohibited. Thanks for fixing this. > > apt-cacher can be run as a daemon or from /etc/inetd.conf and this > configuration is set in response to a debconf question. > > I have a working version of the postinst which I believe complies with > the new policy by no longer changing a value in /etc/default/apt-cacher, > however it contains multiple calls to update-rc.d (one to register the > init file and then calls to enable/disable as appropriate in response to > db_get). This produces the lintian error: > duplicate-updaterc.d-calls-in-postinst. > > Is my approach flawed or is lintian being overzealous? It is a bit overzealous, but I think you have another problem. Your package will override local admin on upgrades (if they changed the config manually) by calling update-rc.d and update-inetd. I think you need to change it to not do so. I don't know much about update-inetd but the pattern for update-rc.d should be something like this: if [ $1 = configure ] || [ $1 == abort-upgrade ] ; then db_get apt-cacher/mode case "$RET" in daemon) update_rc_args="apt-cacher defaults" ;; inetd) manual) update_rc_args="apt-cacher defaults-disabled" ;; esac fi if [ $1 = reconfigure ] ; then db_get apt-cacher/mode case "$RET" in daemon) update_rc_args="apt-cacher enable" ;; inetd) update_rc_args="apt-cacher disable" ;; manual) update_rc_args="" #do nothing ;; esac fi if [ -n "$update_rc_args" ] ; then update-rc.d $update_rc_args fi if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then if [ -x "/etc/init.d/apt-cacher" ]; then invoke-rc.d apt-cacher start || exit $? fi fi PS: you might want to take a look at the socket-activation features of systemd. You could have systemd-systems be always socket-activated. One might even think of removing the standalone daemon mode -- Saludos
Standards 4.1.3 and apt-cacher
Hello, I am trying to upgrade apt-cacher to Standards version 4.1.3. In particular using DISABLED=yes|no in /etc/defaults is now prohibited. apt-cacher can be run as a daemon or from /etc/inetd.conf and this configuration is set in response to a debconf question. I have a working version of the postinst which I believe complies with the new policy by no longer changing a value in /etc/default/apt-cacher, however it contains multiple calls to update-rc.d (one to register the init file and then calls to enable/disable as appropriate in response to db_get). This produces the lintian error: duplicate-updaterc.d-calls-in-postinst. Is my approach flawed or is lintian being overzealous? Any other suggestions? A pruned version of postinst is below. Thanks for your help. Mark # Split of standard dh_installinit block. invoke-rc.d at end of script if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then if [ -x "/etc/init.d/apt-cacher" ]; then update-rc.d apt-cacher defaults >/dev/null fi fi case "$1" in reconfigure|configure) db_get apt-cacher/mode case "$RET" in daemon) echo "Setup apt-cacher running as standalone daemon." update-inetd --remove "3142\s.+/usr/sbin/apt-cacher" # PCRE update-rc.d apt-cacher enable > /dev/null ;; inetd) echo "Setup apt-cacher running from /etc/inetd.conf." update-inetd --add "3142\tstream\ttcp\tnowait\twww-data\t/usr/sbin/apt-cacher\tapt-cacher\t-i" update-rc.d apt-cacher disable > /dev/null ;; manual) # Disable inetd and daemon update-inetd --remove "3142\s.+/usr/sbin/apt-cacher" # PCRE update-rc.d apt-cacher disable > /dev/null cat <&2 exit 1 ;; esac if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then if [ -x "/etc/init.d/apt-cacher" ]; then invoke-rc.d apt-cacher start || exit $? fi fi exit 0