diff options
author | Dmitry Bogatov <KAction@gnu.org> | 2017-03-02 13:48:19 +0300 |
---|---|---|
committer | Dmitry Bogatov <KAction@gnu.org> | 2017-03-02 13:48:19 +0300 |
commit | 1d0b451857a58613deb0366cc3436a0bad25a938 (patch) | |
tree | 3ab33bce4b2b2dcba47c599cbcdee5433959a47b /postrm-runit | |
parent | fa229e9d6d037e08ff548b80a9b43ffded8e352a (diff) |
Introduce new binary package 'runit-helper', allowing packages to access fixes and improvements in 'dh-runit' without rebuild.
Diffstat (limited to 'postrm-runit')
-rw-r--r-- | postrm-runit | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/postrm-runit b/postrm-runit index 5ce6acf..edd9ee7 100644 --- a/postrm-runit +++ b/postrm-runit | |||
@@ -1,44 +1,6 @@ | |||
1 | # -*- shell-script -*- | 1 | # -*- shell-script -*- |
2 | 2 | export NAME='#NAME#' | |
3 | if [ "$1" = 'purge' ] ; then | 3 | /lib/runit-helper/runit-helper postrm "$@" |
4 | # If runscript was never invoked, there will be no files | ||
5 | # in this directory, and `dpkg' will remove it. In this case, | ||
6 | # we have nothing to do. | ||
7 | for supervise in '/var/lib/runit/supervise/#NAME#' \ | ||
8 | '/var/lib/runit/log/supervise/#NAME#' ; do | ||
9 | if [ -d "$supervise" ] ; then | ||
10 | |||
11 | # Actually only `down' may be absent, but it does not | ||
12 | # matter. | ||
13 | |||
14 | for file in control lock ok pid stat status down ; do | ||
15 | rm -f "$supervise/$file" | ||
16 | done | ||
17 | |||
18 | # It should be empty now. If it is not, it means that | ||
19 | # system administrator put something there. It is very | ||
20 | # stupid, but will of user is sacred, and directory is | ||
21 | # left as-is in such case. | ||
22 | # | ||
23 | # NOTE: Non-POSIX option is used. The day coreutils will | ||
24 | # no longer be essential, it will require a fix. | ||
25 | rmdir --ignore-fail-on-non-empty "$supervise" | ||
26 | fi | ||
27 | done | ||
28 | fi | ||
29 | |||
30 | # Following code makes sure, that after removal of package, in default | ||
31 | # setup, the only files belonged to log user, belong to root. | ||
32 | # | ||
33 | # This way user can be safely removed, solving part of #848239 (need | ||
34 | # interoperation from dh-sysuser). | ||
35 | # | ||
36 | # Sure, system administrator can make stupid thing and chown some file | ||
37 | # to log user, but consequences do not seem to be so severe. After | ||
38 | # all, with great power comes great responsibility. | ||
39 | if [ -d '/var/log/runit/#NAME#' ] ; then | ||
40 | chown --recursive root:root '/var/log/runit/#NAME#' | ||
41 | fi | ||
42 | 4 | ||
43 | # Local Variables: | 5 | # Local Variables: |
44 | # eval: (sh-set-shell "sh" t nil) | 6 | # eval: (sh-set-shell "sh" t nil) |