diff options
author | Dmitry Bogatov <KAction@gnu.org> | 2016-06-09 18:50:22 +0300 |
---|---|---|
committer | Dmitry Bogatov <KAction@gnu.org> | 2016-06-09 18:50:22 +0300 |
commit | fc35408ab60287a4e978ba93e61c2ded44342e7d (patch) | |
tree | 2d96b90cc3a03e1daeefb9d540046c6ae5efb634 /dh_runit | |
parent | 9002e984d29480a3287506c73d82f247b0dbacea (diff) |
Improve handling of maintainer scripts
* checking for /etc/service symlink is moved into preinst
* runscripts are enabled in postinst
* runscripts are disables in prerm
* supervise directory is purged on 'postrm purge'
Diffstat (limited to 'dh_runit')
-rwxr-xr-x | dh_runit | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -72,6 +72,10 @@ sub ensure_executable($directory) { | |||
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | sub runit_autoscript($pkg, $script, $sed) { | ||
76 | autoscript($pkg, $script, "$script-runit", $sed); | ||
77 | } | ||
78 | |||
75 | init(option => { 'no-enable' => \$dh{NO_ENABLE} }); | 79 | init(option => { 'no-enable' => \$dh{NO_ENABLE} }); |
76 | 80 | ||
77 | PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { | 81 | PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { |
@@ -82,6 +86,7 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { | |||
82 | my $runit = pkgfile($pkg, 'runit'); | 86 | my $runit = pkgfile($pkg, 'runit'); |
83 | next unless $runit; | 87 | next unless $runit; |
84 | 88 | ||
89 | runit_autoscript($pkg, 'preinst', ''); | ||
85 | install_dir($sv_dir); | 90 | install_dir($sv_dir); |
86 | 91 | ||
87 | for my $words (filedoublearray($runit)) { | 92 | for my $words (filedoublearray($runit)) { |
@@ -102,9 +107,10 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { | |||
102 | "/var/lib/runit/supervise/$name", $tmp); | 107 | "/var/lib/runit/supervise/$name", $tmp); |
103 | 108 | ||
104 | if ($enable eq 'enable' && !$dh{NO_ENABLE}) { | 109 | if ($enable eq 'enable' && !$dh{NO_ENABLE}) { |
105 | autoscript($pkg, 'postinst', 'postinst-runit', "s/#NAME#/$name/"); | 110 | runit_autoscript($pkg, 'postinst', "s/#NAME#/$name/"); |
106 | } | 111 | } |
107 | autoscript($pkg, 'prerm', 'prerm-runit', "s/#NAME#/$name/"); | 112 | runit_autoscript($pkg, 'prerm', "s/#NAME#/$name/"); |
113 | runit_autoscript($pkg, 'postrm', "s/#NAME#/$name/"); | ||
108 | } | 114 | } |
109 | addsubstvar($pkg, 'misc:Depends', 'runit', '>= 2.1.2-4'); | 115 | addsubstvar($pkg, 'misc:Depends', 'runit', '>= 2.1.2-4'); |
110 | } | 116 | } |