From 57a8c6e20c63aaa3f6c328c4fb6a2a1a6d5a654b Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Sun, 14 Aug 2016 11:00:57 +0300 Subject: Clean-up supervision directory of log process too. --- debian/changelog | 1 + postrm-runit | 40 +++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/debian/changelog b/debian/changelog index ecbeb9c..29c6bea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ dh-runit (1.5) UNRELEASED; urgency=medium * Fix typo in mkdir option. * Force shutdown of service we are uninstalling. Otherwise, it would be 5 seconds gap, when process are still alive. + * Clean-up supervision directory of log process too. -- Dmitry Bogatov Sat, 13 Aug 2016 11:40:10 +0300 diff --git a/postrm-runit b/postrm-runit index cc19d38..9a69a53 100644 --- a/postrm-runit +++ b/postrm-runit @@ -1,28 +1,30 @@ # -*- shell-script -*- if [ "$1" = 'purge' ] ; then - # 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. - supervise_dir="/var/lib/runit/supervise/#NAME#" - if [ -d "$supervise_dir" ] ; then + # 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. + for supervise in "/var/lib/runit/supervise/#NAME#" \ + "/var/lib/runit/log/supervise/#NAME#" ; do + if [ -d "$supervise" ] ; then - # Actually only `down' may be absent, but it does not - # matter. + # Actually only `down' may be absent, but it does not + # matter. - for file in control lock ok pid stat status down ; do - rm -f "$supervise_dir/$file" - done + for file in control lock ok pid stat status down ; do + rm -f "$supervise/$file" + done - # It should be empty now. If it is not, it means that system administrator put - # something there. It is very stupid, but will of user is sacred, and directory - # is left as-is in such case. - # - # NOTE: Non-POSIX option is used. The day coreutils will no longer be essential, - # it will require a fix. - rmdir --ignore-fail-on-non-empty "$supervise_dir" - fi - unset supervise_dir + # It should be empty now. If it is not, it means that + # system administrator put something there. It is very + # stupid, but will of user is sacred, and directory is + # left as-is in such case. + # + # NOTE: Non-POSIX option is used. The day coreutils will + # no longer be essential, it will require a fix. + rmdir --ignore-fail-on-non-empty "$supervise" + fi + done fi # Local Variables: -- cgit v1.2.3