summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Bogatov <KAction@gnu.org>2016-06-04 16:22:47 +0300
committerDmitry Bogatov <KAction@gnu.org>2016-06-04 16:22:47 +0300
commitdc74a67ae5e1e13b8fb815236dd8efdfce962ba0 (patch)
treec8a1a1425f1e412f310eca651b303d6c3092fd39
Initial commit
-rw-r--r--debian/changelog5
-rw-r--r--debian/clean1
-rw-r--r--debian/compat1
-rw-r--r--debian/control19
-rw-r--r--debian/copyright24
-rw-r--r--debian/dh-runit.install2
-rw-r--r--debian/dh-runit.manpages1
-rwxr-xr-xdebian/rules8
-rw-r--r--debian/source/format1
-rwxr-xr-xdh_runit96
-rw-r--r--runit.pm11
11 files changed, 169 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..85b528f
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
1dh-runit (0.1) unstable; urgency=medium
2
3 * Initial release (Closes: #nnnn)
4
5 -- Dmitry Bogatov <KAction@gnu.org> Sat, 04 Jun 2016 13:41:17 +0300
diff --git a/debian/clean b/debian/clean
new file mode 100644
index 0000000..0bbfb79
--- /dev/null
+++ b/debian/clean
@@ -0,0 +1 @@
dh_runit.1 \ No newline at end of file
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..08d73ab
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,19 @@
1Source: dh-runit
2Section: admin
3Priority: optional
4Maintainer: Dmitry Bogatov <KAction@gnu.org>
5Build-Depends: debhelper (>=9), perl, perl-doc
6Standards-Version: 3.9.8
7Vcs-Browser: https://anonscm.debian.org/cgit/users/kaction-guest/cligh.git
8Vcs-Git: https://anonscm.debian.org/cgit/users/kaction-guest/cligh.git
9
10Package: dh-runit
11Architecture: any
12Depends: debhelper (>= 9), ${shlibs:Depends}, ${misc:Depends}
13Description: debhelper add-on to handle runit runscripts
14 dh-runit provides a debhelper sequence addon named 'runit' and the
15 dh_runit command.
16 .
17 The dh_runit command installs runscripts and adds the appropriate code to
18 the postinst, prerm and postrm maint scripts to properly enable/disable
19 runscripts. \ No newline at end of file
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..76c07b8
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,24 @@
1Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2Upstream-Name: dh-runit
3Source: https://anonscm.debian.org/cgit/users/kaction-guest/cligh.git
4
5Files: *
6Copyright: 2016 Dmitry Bogatov <KAction@gnu.org>
7License: GPL-3+
8
9License: GPL-3+
10 This package is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
14 .
15 This package is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 .
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <https://www.gnu.org/licenses/>
22 .
23 On Debian systems, the complete text of the GNU General
24 Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". \ No newline at end of file
diff --git a/debian/dh-runit.install b/debian/dh-runit.install
new file mode 100644
index 0000000..7899e96
--- /dev/null
+++ b/debian/dh-runit.install
@@ -0,0 +1,2 @@
1dh_runit /usr/bin
2runit.pm /usr/share/perl5/Debian/Debhelper/Sequence \ No newline at end of file
diff --git a/debian/dh-runit.manpages b/debian/dh-runit.manpages
new file mode 100644
index 0000000..0bbfb79
--- /dev/null
+++ b/debian/dh-runit.manpages
@@ -0,0 +1 @@
dh_runit.1 \ No newline at end of file
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..6f65fce
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,8 @@
1#!/usr/bin/make -f
2
3%:
4 dh $@
5
6override_dh_installman:
7 pod2man dh_runit dh_runit.1
8 dh_installman
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
3.0 (native)
diff --git a/dh_runit b/dh_runit
new file mode 100755
index 0000000..dec7c5a
--- /dev/null
+++ b/dh_runit
@@ -0,0 +1,96 @@
1#!/usr/bin/perl -w
2
3=head1 NAME
4
5dh_runit - install/enable runit runscripts
6
7=cut
8
9use strict;
10use Debian::Debhelper::Dh_Lib;
11use File::Find;
12use Path::Tiny;
13use File::stat;
14
15=head1 SYNOPSIS
16
17B<dh_runit> [S<I<debhelper options>>] [B<--no-enable>]
18
19=head1 DESCRIPTION
20
21B<dh_runit> is a debhelper program that is responsible for
22installing and enabling I<runit> runscripts. If file named
23F<debian/I<package>.runit> exists, then different actions
24are performed, depending on its format.
25
26For runit, every unit of supervision, simply speaking program, is
27represented by directory under F</etc/sv>, containing at least F<run>
28executable file. Every enabled program is represented by symbolic link
29under F</etc/services> pointing to some directory under F</etc/sv>.
30
31If F<debian/I<package>.runit> is not executable, but contains shebang
32(#!) in first line, it is installed as F</etc/sv/I<package>/run> and
33enabled.
34
35Alternatively, F<debian/I<package>.runit> is a list of lines, where
36every line is either starts with hash symbol and considered comment,
37or contains two or three space-separated words.
38
39 # In this case file is installed as 'run' script. Directory name under
40 # /etc/sv is derived from file basename
41 enable path/to/file/to/be/installed/as/run/script
42
43 # Same, but install directory as whole. It is your responsibility
44 # to ensure is contains everything required.
45 enable path/to/directory
46
47 # Same as above, but do not create symlink under /etc/service
48 disable path/to/directory
49
50 # Also, you can explicitly specify name of directory under /etc/sv
51 enable path/to/directory my-preferred-name
52
53=head1 OPTIONS
54
55=over 4
56
57=item B<--no-enable>
58
59Do not enable any runscripts. Useful, when F<debian/I<package>.runit>
60is the only runscript, in which case you have no other ways to
61specify, that it should not be enabled.
62
63=back
64
65=cut
66
67init(option => { 'no-enable' => \$dh{NO_ENABLE} });
68
69PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) {
70 next if is_udeb($pkg);
71
72 my $tmp = tmpdir($pkg);
73 my $sv_dir = "$tmp/etc/sv";
74 my $runit = pkgfile($pkg, 'runit');
75 next unless $runit;
76
77 doit('install', '-d', $sv_dir);
78
79 for my $line (path($runit)->lines) {
80 next if ($line =~ /^#/); # skip comments
81 next if ($line =~ /^\s*$/); # skip empty lines
82 (my $enable, my $path, my $name) = split /\s/, $line;
83 $name = $name || basename($path);
84
85 error("can't read `$path'") unless -r $path;
86
87 if ( -f $path) {
88 doit('install', 'd', '-m755', $path, "$sv_dir/$name/run");
89 } elsif ( -d $path) {
90 doit('cp', '-r', $path, "$sv_dir/$name");
91 }
92 if ($enable -eq 'enable' && !$DH{NO_ENABLE}) {
93 }
94 }
95}
96
diff --git a/runit.pm b/runit.pm
new file mode 100644
index 0000000..d434d1b
--- /dev/null
+++ b/runit.pm
@@ -0,0 +1,11 @@
1#!/usr/bin/perl
2use warnings;
3use strict;
4use Debian::Debhelper::Dh_Lib;
5
6# dh_runit installs scripts as provided by source package. It would
7# be nice to maintainers to allow them to not worry about executable
8# bit.
9insert_before('dh_fixperms', 'dh_runit');
10
111;