summaryrefslogtreecommitdiff
path: root/dh_runit
diff options
context:
space:
mode:
authorDmitry Bogatov <KAction@gnu.org>2016-06-08 23:12:38 +0300
committerDmitry Bogatov <KAction@gnu.org>2016-06-08 23:12:38 +0300
commit2522d781a1fe724f8433160f0df9a3091aeacfb6 (patch)
treecdb800ba5649f3ab6b7b647e0b146108a9f9e879 /dh_runit
parent28dfe2564c8f6bc4422b4d1eee7d707190bea7db (diff)
Improve created /etc/sv/${NAME} directory
* ensure that run/finish scripts are executable * create 'supervise' symlink to not pollute /etc/ directory
Diffstat (limited to 'dh_runit')
-rwxr-xr-xdh_runit17
1 files changed, 16 insertions, 1 deletions
diff --git a/dh_runit b/dh_runit
index ba066d8..28daea0 100755
--- a/dh_runit
+++ b/dh_runit
@@ -11,6 +11,8 @@ use Debian::Debhelper::Dh_Lib;
11use File::Find; 11use File::Find;
12use Path::Tiny; 12use Path::Tiny;
13use File::stat; 13use File::stat;
14use feature 'signatures';
15no 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
69sub 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
67init(option => { 'no-enable' => \$dh{NO_ENABLE} }); 76init(option => { 'no-enable' => \$dh{NO_ENABLE} });
68 77
69PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { 78PKG: 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 }