From fc35408ab60287a4e978ba93e61c2ded44342e7d Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Thu, 9 Jun 2016 18:50:22 +0300 Subject: 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' --- dh_runit | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'dh_runit') diff --git a/dh_runit b/dh_runit index 16af671..13caec5 100755 --- a/dh_runit +++ b/dh_runit @@ -72,6 +72,10 @@ sub ensure_executable($directory) { } } +sub runit_autoscript($pkg, $script, $sed) { + autoscript($pkg, $script, "$script-runit", $sed); +} + init(option => { 'no-enable' => \$dh{NO_ENABLE} }); PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { @@ -82,6 +86,7 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { my $runit = pkgfile($pkg, 'runit'); next unless $runit; + runit_autoscript($pkg, 'preinst', ''); install_dir($sv_dir); for my $words (filedoublearray($runit)) { @@ -102,9 +107,10 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { "/var/lib/runit/supervise/$name", $tmp); if ($enable eq 'enable' && !$dh{NO_ENABLE}) { - autoscript($pkg, 'postinst', 'postinst-runit', "s/#NAME#/$name/"); + runit_autoscript($pkg, 'postinst', "s/#NAME#/$name/"); } - autoscript($pkg, 'prerm', 'prerm-runit', "s/#NAME#/$name/"); + runit_autoscript($pkg, 'prerm', "s/#NAME#/$name/"); + runit_autoscript($pkg, 'postrm', "s/#NAME#/$name/"); } addsubstvar($pkg, 'misc:Depends', 'runit', '>= 2.1.2-4'); } -- cgit v1.2.3