diff options
-rwxr-xr-x | dh_runit | 17 | ||||
-rw-r--r-- | postinst-runit | 6 | ||||
-rw-r--r-- | prerm-runit | 1 |
3 files changed, 19 insertions, 5 deletions
@@ -11,6 +11,8 @@ use Debian::Debhelper::Dh_Lib; | |||
11 | use File::Find; | 11 | use File::Find; |
12 | use Path::Tiny; | 12 | use Path::Tiny; |
13 | use File::stat; | 13 | use File::stat; |
14 | use feature 'signatures'; | ||
15 | no warnings 'experimental::signatures'; | ||
14 | 16 | ||
15 | =head1 SYNOPSIS | 17 | =head1 SYNOPSIS |
16 | 18 | ||
@@ -64,6 +66,13 @@ specify, that it should not be enabled. | |||
64 | 66 | ||
65 | =cut | 67 | =cut |
66 | 68 | ||
69 | sub ensure_executable($directory) { | ||
70 | for my $f ('run', 'finish', 'log/run', 'log/finish') { | ||
71 | my $file = "$directory/$f"; | ||
72 | doit('chmod', '+x', $file) if (-e $file); | ||
73 | } | ||
74 | } | ||
75 | |||
67 | init(option => { 'no-enable' => \$dh{NO_ENABLE} }); | 76 | init(option => { 'no-enable' => \$dh{NO_ENABLE} }); |
68 | 77 | ||
69 | PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { | 78 | PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { |
@@ -85,10 +94,16 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { | |||
85 | error("can't read `$path'") unless -r $path; | 94 | error("can't read `$path'") unless -r $path; |
86 | 95 | ||
87 | if ( -f $path) { | 96 | if ( -f $path) { |
88 | doit('install', 'd', '-m755', $path, "$sv_dir/$name/run"); | 97 | install_dir("$sv_dir/$name"); |
98 | install_prog($path, "$sv_dir/$name/run"); | ||
89 | } elsif ( -d $path) { | 99 | } elsif ( -d $path) { |
90 | doit('cp', '-r', $path, "$sv_dir/$name"); | 100 | doit('cp', '-r', $path, "$sv_dir/$name"); |
101 | # Unfortunately, dh_fixperms does not handle executable bit here. | ||
102 | ensure_executable("$sv_dir/$name"); | ||
91 | } | 103 | } |
104 | make_symlink("/etc/sv/$name/supervise", | ||
105 | "/var/lib/runit/supervise/$name", $tmp); | ||
106 | |||
92 | if ($enable eq 'enable' && !$dh{NO_ENABLE}) { | 107 | if ($enable eq 'enable' && !$dh{NO_ENABLE}) { |
93 | autoscript($pkg, 'postinst', 'postinst-runit', "s/#NAME#/$name/"); | 108 | autoscript($pkg, 'postinst', 'postinst-runit', "s/#NAME#/$name/"); |
94 | } | 109 | } |
diff --git a/postinst-runit b/postinst-runit index 8b09a95..7c21f0e 100644 --- a/postinst-runit +++ b/postinst-runit | |||
@@ -16,7 +16,5 @@ restart installation. | |||
16 | EOF | 16 | EOF |
17 | exit 1 | 17 | exit 1 |
18 | fi | 18 | fi |
19 | ln -s '/etc/sv/#NAME#' "$SV_DIR/" | 19 | ln -sf '/etc/sv/#NAME#' "$SV_DIR/" |
20 | 20 | mkdir -p /var/lib/runit/supervise/#NAME# | |
21 | |||
22 | |||
diff --git a/prerm-runit b/prerm-runit index a919418..b23abeb 100644 --- a/prerm-runit +++ b/prerm-runit | |||
@@ -1 +1,2 @@ | |||
1 | rm -f /etc/service/#NAME# | 1 | rm -f /etc/service/#NAME# |
2 | rm -fr /var/lib/runit/supervise/#NAME#/* | ||