summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Bogatov <KAction@gnu.org>2016-06-09 18:02:54 +0300
committerDmitry Bogatov <KAction@gnu.org>2016-06-09 18:02:54 +0300
commit98ca0e7d822a7ddb78a911e85c0f18553fbaa862 (patch)
tree9d4e21920560d967715a52343d5749c5a98133f7
parent1260e2dc07f4d1556380501e5f1010ebed2c27c4 (diff)
Use filedoublearray to simplify code
-rw-r--r--debian/control1
-rwxr-xr-xdh_runit9
2 files changed, 4 insertions, 6 deletions
diff --git a/debian/control b/debian/control
index f0ec5a8..b5f64d8 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,6 @@ Homepage: https://anonscm.debian.org/cgit/users/kaction-guest/dh-runit.git
11Package: dh-runit 11Package: dh-runit
12Architecture: any 12Architecture: any
13Depends: debhelper (>= 9), 13Depends: debhelper (>= 9),
14 libpath-tiny-perl,
15 perl-modules, 14 perl-modules,
16 ${misc:Depends}, 15 ${misc:Depends},
17 ${shlibs:Depends} 16 ${shlibs:Depends}
diff --git a/dh_runit b/dh_runit
index 28daea0..0e1d320 100755
--- a/dh_runit
+++ b/dh_runit
@@ -9,7 +9,6 @@ dh_runit - install/enable runit runscripts
9use strict; 9use strict;
10use Debian::Debhelper::Dh_Lib; 10use Debian::Debhelper::Dh_Lib;
11use File::Find; 11use File::Find;
12use Path::Tiny;
13use File::stat; 12use File::stat;
14use feature 'signatures'; 13use feature 'signatures';
15no warnings 'experimental::signatures'; 14no warnings 'experimental::signatures';
@@ -85,10 +84,8 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) {
85 84
86 doit('install', '-d', $sv_dir); 85 doit('install', '-d', $sv_dir);
87 86
88 for my $line (path($runit)->lines) { 87 for my $words (filedoublearray($runit)) {
89 next if ($line =~ /^#/); # skip comments 88 (my $enable, my $path, my $name) = @{$words};
90 next if ($line =~ /^\s*$/); # skip empty lines
91 (my $enable, my $path, my $name) = split /\s/, $line;
92 $name = $name || basename($path); 89 $name = $name || basename($path);
93 90
94 error("can't read `$path'") unless -r $path; 91 error("can't read `$path'") unless -r $path;
@@ -110,3 +107,5 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) {
110 autoscript($pkg, 'prerm', 'prerm-runit', "s/#NAME#/$name/"); 107 autoscript($pkg, 'prerm', 'prerm-runit', "s/#NAME#/$name/");
111 } 108 }
112} 109}
110
111# PROMISE: DH NOOP WITHOUT runit