diff options
author | Dmitry Bogatov <KAction@gnu.org> | 2016-06-08 23:12:38 +0300 |
---|---|---|
committer | Dmitry Bogatov <KAction@gnu.org> | 2016-06-08 23:12:38 +0300 |
commit | 2522d781a1fe724f8433160f0df9a3091aeacfb6 (patch) | |
tree | cdb800ba5649f3ab6b7b647e0b146108a9f9e879 /dh_runit | |
parent | 28dfe2564c8f6bc4422b4d1eee7d707190bea7db (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-x | dh_runit | 17 |
1 files changed, 16 insertions, 1 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 | } |