From c870dcaa53988f709b1152221e76992972365fb5 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Wed, 23 May 2018 08:23:08 +0300 Subject: Do not re-enable serice on upgrade * Do not make symbolic link /etc/runit/runsvdir/default/$name -> /etc/sv/$name part of package files {in which case it will be unconditionally created on upgrade}; instead manage it in maintainer scripts: create it in postinst script on fresh install and remove on purge/remove in postrm. * Force versioned dependency on runit-helper, to make sure that versioned dependency on dh-runit would close #899242 --- runit-helper | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'runit-helper') diff --git a/runit-helper b/runit-helper index e48020b..05724af 100755 --- a/runit-helper +++ b/runit-helper @@ -18,7 +18,25 @@ set -e +postinst () { + local action="${1}" previous="${2:-}" + + # Fresh installation (not upgrade). It is important to not override + # local admin decision (see #899242). + if [ "${ENABLE}" = yes ] && [ -z "${previous}" ] ; then + ln -sf "/etc/sv/$NAME" "/etc/runit/runsvdir/default/$NAME" + fi +} + postrm () { + local action="${1}" + + if [ "${action}" != 'purge' ] && [ "${action}" != 'remove' ] ; then + return + fi + + # Links in other runsvdirs is responsibility of administrator. + rm -f "/etc/runit/runsvdir/default/$NAME" # Following code makes sure, that after removal of package, in default # setup, the only files belonged to log user, belong to root. @@ -33,10 +51,6 @@ postrm () { chown --recursive root:root "/var/log/runit/$NAME" fi - if [ "$1" != 'purge' ] ; then - return - fi - # If runscript was never invoked, there will be no files # in this directory, and `dpkg' will remove it. In this case, # we have nothing to do. @@ -64,3 +78,4 @@ postrm () { } "$@" +# vim: sw=4:et -- cgit v1.2.3