Commit 344808ce authored by Lorenzo Faletra's avatar Lorenzo Faletra

Import Debian version 1.45parrot0

parent 9969db86
# init-system-helpers
init scripts modified in order to avoid automatic services startup
most interesting file is
init-system-helpers/script/parrot-update-rc.d
init-system-helpers (1.45parrot0) testing; urgency=medium
* Import new version from debian
* Re-apply Parrot patches
-- Lorenzo "Palinuro" Faletra <palinuro@parrotsec.org> Sun, 23 Oct 2016 17:56:52 +0200
init-system-helpers (1.45) unstable; urgency=medium
* Revert "invoke-rc.d, service: Asynchronously reload systemd units"
This caused fallout at least in the autopkgtests of two packages, possibly many
more, thus could also break assumptions in more important environments, and was
just a defensive move, not a bug fix.
This reverts commit 9cfb6dfed4a38b7c3d8b7fd04a7681690049e424.
-- Martin Pitt <mpitt@debian.org> Tue, 20 Sep 2016 16:27:43 +0200
init-system-helpers (1.44) unstable; urgency=medium
* invoke-rc.d, service: Check for multi-user.target instead of
graphical.target. There is a curious bug which sometimes causes
"systemctl is-active default.target" to say inactive until "show" or
"status" gets called on the unit. This needs to be investigated. Until
then, check for multi-user.target which by and large does the same job,
but seems to work reliably.
-- Martin Pitt <mpitt@debian.org> Mon, 12 Sep 2016 22:52:23 +0200
init-system-helpers (1.43) unstable; urgency=medium
[ Felipe Sateler ]
* Add /etc/rc?.d to the dirs shipped by init-system-helpers.
(Closes: #834524)
[ Martin Pitt ]
* invoke-rc.d, service: Only ignore systemd unit dependencies before
default.target. "systemctl is-system-running" might still be false in case
of running jobs for device/mount/hotplug/dynamic actions units. But in
those cases we already do want to respect unit dependencies, as the system
is booted up sufficiently to avoid dependency loops. Fixes installation of
packages like PostgreSQL under cloud-init or when manually installing
packages right after booting. (LP: #1576692)
* invoke-rc.d, service: Asynchronously reload systemd units.
Reloading SysV init scripts has never been synchronous, so use --no-block
to reload them under systemd. This is another, and a better, line of
defence against if-up.d hook deadlocks during boot (see
https://bugs.debian.org/777113).
-- Martin Pitt <mpitt@debian.org> Mon, 12 Sep 2016 09:35:28 +0200
init-system-helpers (1.42+parrot0) testing; urgency=medium
* Minor fixes
......
Source: init-system-helpers
Section: admin
Priority: extra
Maintainer: Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>
Uploaders: Michael Biebl <biebl@debian.org>,
Martin Pitt <mpitt@debian.org>,
Maintainer: Parrot Devel Team <parrot-devel@lists.parrotsec.org>
Uploaders: Lorenzo "Palinuro" Faletra <palinuro@parrotsec.org>
Build-Depends: debhelper (>= 9),
perl:any,
Standards-Version: 3.9.8
......@@ -13,6 +12,7 @@ Vcs-Browser: https://anonscm.debian.org/git/collab-maint/init-system-helpers.git
Package: init-system-helpers
Architecture: all
Priority: required
Essential: yes
Multi-Arch: foreign
Depends: perl-base (>= 5.20.1-3),
${misc:Depends},
......@@ -41,31 +41,24 @@ Description: helper tools for all init systems
include their helpers in this package.
Package: dh-systemd
Section: oldlibs
Architecture: all
Multi-Arch: foreign
Depends: debhelper,
Depends: debhelper (>= 9.20160709),
${misc:Depends},
${perl:Depends},
Suggests: augeas-tools,
Description: debhelper add-on to handle systemd unit files
dh-systemd provides a debhelper sequence addon named 'systemd' and the
dh_systemd_enable/dh_systemd_start commands.
.
The dh_systemd_enable command adds the appropriate code to the postinst, prerm
and postrm maint scripts to properly enable/disable systemd service files.
The dh_systemd_start command deals with start/stop/restart on upgrades for
systemd-only service files.
Description: debhelper add-on to handle systemd unit files - transitional package
This package is for transitional purposes and can be removed safely.
Package: init
Section: metapackages
Architecture: any
Essential: yes
Priority: required
Priority: important
XB-Important: yes
Multi-Arch: foreign
Pre-Depends: systemd-sysv [linux-any] | sysvinit-core,
Pre-Depends: systemd-sysv [linux-any] ${alt:sysvinit},
Depends: init-system-helpers,
${misc:Depends},
Description: init metapackage
This package is an essential metapackage which allows you to select from
the available init systems in Debian (systemd, sysvinit) while
ensuring that one of these is available on the system at all times.
This package is a metapackage which allows you to select from the available
init systems while ensuring that one of these is available on the system at
all times.
......@@ -4,11 +4,6 @@ Files: *
Copyright: 2013 Michael Stapelberg
License: BSD-3-clause
Files: systemd2init
Copyright: 2014 Ondřej Surý <ondrej@sury.org>
2014 Lukáš Zapletal <lzap+git@redhat.com>
License: GPL-3+
Files: debian/*
Copyright: 2013 Michael Stapelberg <stapelberg@debian.org>
License: BSD-3-clause
......
[dch]
full = True
multimaint-merge = True
/etc/rc0.d
/etc/rc1.d
/etc/rc2.d
/etc/rc3.d
/etc/rc4.d
/etc/rc5.d
/etc/rc6.d
/etc/rcS.d
/etc/systemd/system
/var/lib/systemd
......@@ -9,10 +9,7 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
BUILD_DATE = $(shell dpkg-parsechangelog -S Date)
VERSION = $(shell dpkg-parsechangelog -S Version)
POD_MAN_DATE = $(shell date -u +"%Y-%m-%d" --date="$(BUILD_DATE)")
export POD_MAN_DATE
override_dh_perl:
dh_perl -d --package=init-system-helpers
......@@ -31,5 +28,13 @@ override_dh_install-indep:
cp script/parrot-update-rc.d $(SBIN)/update-rc.d
[ ! -d debian/init-system-helpers ] || sed -i 's/__VERSION__/$(VERSION)/' debian/init-system-helpers/usr/sbin/service
override_dh_gencontrol:
if dpkg-vendor --derives-from ubuntu; then \
dh_gencontrol -- -Valt:sysvinit=""; \
else \
dh_gencontrol -- -Valt:sysvinit="| sysvinit-core"; \
fi
%:
dh $@
dh $@
if deb-systemd-helper debian-installed #UNITFILE#; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask #UNITFILE# >/dev/null || true
if deb-systemd-helper --quiet was-enabled #UNITFILE#; then
# Create new symlinks, if any.
deb-systemd-helper enable #UNITFILE# >/dev/null || true
fi
fi
# Update the statefile to add new symlinks (if any), which need to be cleaned
# up on purge. Also remove old symlinks.
deb-systemd-helper update-state #UNITFILE# >/dev/null || true
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask #UNITFILE# >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled #UNITFILE#; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable #UNITFILE# >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state #UNITFILE# >/dev/null || true
fi
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=try-restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action #UNITFILES# >/dev/null || true
fi
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start #UNITFILES# >/dev/null || true
fi
if [ "$1" = "remove" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask #UNITFILES# >/dev/null
fi
fi
if [ "$1" = "purge" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge #UNITFILES# >/dev/null
deb-systemd-helper unmask #UNITFILES# >/dev/null
fi
fi
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi
if [ -d /run/systemd/system ]; then
deb-systemd-invoke stop #UNITFILES# >/dev/null
fi
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
deb-systemd-invoke stop #UNITFILES# >/dev/null
fi
autoscripts usr/share/debhelper
lib/Debian/Debhelper/Sequence/systemd.pm usr/share/perl5/Debian/Debhelper/Sequence/
script/dh_systemd_enable usr/bin
script/dh_systemd_start usr/bin
systemd2init/skeleton.debian usr/share/dh-systemd
systemd2init/skeleton.redhat usr/share/dh-systemd
systemd2init/systemd2init usr/bin
script/dh_systemd_enable.1p
script/dh_systemd_start.1p
#!/usr/bin/perl
use warnings;
use strict;
use Debian::Debhelper::Dh_Lib;
# dh_systemd_enable runs unconditionally, and before dh_installinit, so that
# the latter can use invoke-rc.d and all symlinks are already in place.
insert_before("dh_installinit", "dh_systemd_enable");
# dh_systemd_start handles the case where there is no corresponding init
# script, so it runs after dh_installinit.
insert_after("dh_installinit", "dh_systemd_start");
1
#!/usr/bin/perl -w
=head1 NAME
dh_systemd_enable - enable/disable systemd unit files
=cut
use strict;
use Debian::Debhelper::Dh_Lib;
use File::Find;
use Text::ParseWords qw(shellwords); # in core since Perl 5
=head1 SYNOPSIS
B<dh_systemd_enable> [S<I<debhelper options>>] [B<--no-enable>] [B<--name=>I<name>] [S<I<unit file> ...>]
=head1 DESCRIPTION
B<dh_systemd_enable> is a debhelper program that is responsible for enabling
and disabling systemd unit files.
In the simple case, it finds all unit files installed by a package (e.g.
bacula-fd.service) and enables them. It is not necessary that the machine
actually runs systemd during package installation time, enabling happens on all
machines in order to be able to switch from sysvinit to systemd and back.
In the complex case, you can call B<dh_systemd_enable> and B<dh_systemd_start>
manually (by overwriting the debian/rules targets) and specify flags per unit
file. An example is colord, which ships colord.service, a dbus-activated
service without an [Install] section. This service file cannot be enabled or
disabled (a state called "static" by systemd) because it has no
[Install] section. Therefore, running dh_systemd_enable does not make sense.
For only generating blocks for specific service files, you need to pass them as
arguments, e.g. B<dh_systemd_enable quota.service> and B<dh_systemd_enable
--name=quotarpc quotarpc.service>.
=head1 FILES
=over 4
=item debian/I<package>.service
If this exists, it is installed into lib/systemd/system/I<package>.service in
the package build directory.
=item debian/I<package>.tmpfile
If this exists, it is installed into usr/lib/tmpfiles.d/I<package>.conf in the
package build directory. (The tmpfiles.d mechanism is currently only used
by systemd.)
=back
=head1 OPTIONS
=over 4
=item B<--no-enable>
Just disable the service(s) on purge, but do not enable them by default.
=item B<--name=>I<name>
Install the service file as I<name.service> instead of the default filename,
which is the I<package.service>. When this parameter is used,
B<dh_systemd_enable> looks for and installs files named
F<debian/package.name.service> instead of the usual F<debian/package.service>.
=back
=head1 NOTES
Note that this command is not idempotent. L<dh_prep(1)> should be called
between invocations of this command (with the same arguments). Otherwise, it
may cause multiple instances of the same text to be added to maintainer
scripts.
Note that B<dh_systemd_enable> should be run before B<dh_installinit>.
The default sequence in B<dh> does the right thing, this note is only relevant
when you are calling B<dh_systemd_enable> manually.
=cut
init(options => {
"no-enable" => \$dh{NO_ENABLE},
});
sub contains_install_section {
my ($unit_path) = @_;
my $fh;
if (!open($fh, '<', $unit_path)) {
warning("Cannot open($unit_path) for extracting the Also= line(s)");
return;
}
while (my $line = <$fh>) {
chomp($line);
return 1 if $line =~ /^\s*\[Install\]$/i;
}
close($fh);
return 0;
}
# PROMISE: DH NOOP WITHOUT tmp(lib/systemd/system) mount service socket target tmpfile
foreach my $package (@{$dh{DOPACKAGES}}) {
my $tmpdir = tmpdir($package);
my @installed_units;
my @units;
# XXX: This is duplicated in dh_installinit, which is unfortunate.
# We do need the service files before running dh_installinit though,
# every other solution makes things much worse for all the maintainers.
# Figure out what filename to install it as.
my $script;
my $jobfile=$package;
if (defined $dh{NAME}) {
$jobfile=$script=$dh{NAME};
}
elsif ($dh{D_FLAG}) {
# -d on the command line sets D_FLAG. We will
# remove a trailing 'd' from the package name and
# use that as the name.
$script=$package;
if ($script=~m/(.*)d$/) {
$jobfile=$script=$1;
}
else {
warning("\"$package\" has no final d' in its name, but -d was specified.");
}
}
elsif ($dh{INIT_SCRIPT}) {
$script=$dh{INIT_SCRIPT};
}
else {
$script=$package;
}
my $service=pkgfile($package,"service");
if ($service ne '') {
my $path="$tmpdir/lib/systemd/system";
if (! -d "$path") {
doit("install","-d","$path");
}
doit("install","-p","-m644",$service,"$path/$script.service");
}
my $target=pkgfile($package,"target");
if ($target ne '') {
my $path="$tmpdir/lib/systemd/system";
if (! -d "$path") {
doit("install","-d","$path");
}
doit("install","-p","-m644",$target,"$path/$script.target");
}
my $socket=pkgfile($package,"socket");
if ($socket ne '') {
my $path="$tmpdir/lib/systemd/system";
if (! -d "$path") {
doit("install","-d","$path");
}
doit("install","-p","-m644",$socket,"$path/$script.socket");
}
my $tmpfile=pkgfile($package,"tmpfile");
if ($tmpfile ne '') {
my $path="$tmpdir/usr/lib/tmpfiles.d";
if (! -d "$path") {
doit("install","-d","$path");
}
doit("install","-p","-m644",$tmpfile,"$path/$script.conf");
}
my $mount=pkgfile($package,"mount");
if ($mount ne '') {
my $path="$tmpdir/usr/lib/system";
if (! -d "$path") {
doit("install","-d","$path");
}
doit("install","-p","-m644",$mount,"$path/$script.mount");
}
find({
wanted => sub {
my $name = $File::Find::name;
return unless -f $name;
# Skip symbolic links, their only legitimate use is for
# adding an alias, e.g. linking smartmontools.service
# -> smartd.service.
return if -l $name;
return unless $name =~ m,^$tmpdir/lib/systemd/system/[^/]+$,;
push @installed_units, $name;
},
no_chdir => 1,
}, "${tmpdir}/lib/systemd/system") if -d "${tmpdir}/lib/systemd/system";
# Handle either only the unit files which were passed as arguments or
# all unit files that are installed in this package.
my @args = @ARGV > 0 ? @ARGV : @installed_units;
# support excluding units via -X
foreach my $x (@{$dh{EXCLUDE}}) {
@args = grep !/(^|\/)$x$/, @args;
}
for my $name (@args) {
my $base = basename($name);
# Try to make the path absolute, so that the user can call
# dh_installsystemd bacula-fd.service
if ($base eq $name) {
# NB: This works because @installed_units contains
# files from precisely one directory.
my ($full) = grep { basename($_) eq $base } @installed_units;
if (defined($full)) {
$name = $full;
} else {
warning(qq|Could not find "$name" in the /lib/systemd/system directory of $package. | .
qq|This could be a typo, or using Also= with a service file from another package. | .
qq|Please check carefully that this message is harmless.|);
}
}
# Skip template service files like e.g. getty@.service.
# Enabling, disabling, starting or stopping those services
# without specifying the instance (e.g. getty@ttyS0.service) is
# not useful.
if ($name =~ /\@/) {
next;
}
# Skip unit files that dont have an [Install] section.
next unless contains_install_section($name);
push @units, $name;
}
next if @units == 0;
my $unitargs = join(" ", sort map { basename($_) } @units);
for my $unit (sort @units) {
my $base = basename($unit);
if ($dh{NO_ENABLE}) {
autoscript($package, "postinst", "postinst-systemd-dont-enable", "s/#UNITFILE#/$base/");
} else {
autoscript($package, "postinst", "postinst-systemd-enable", "s/#UNITFILE#/$base/");
}
}
autoscript($package, "postrm", "postrm-systemd", "s/#UNITFILES#/$unitargs/");
# init-system-helpers ships deb-systemd-helper which we use in our
# autoscripts
addsubstvar($package, "misc:Depends", "init-system-helpers (>= 1.18~)");
}
=head1 SEE ALSO
L<dh_systemd_start(1)>, L<debhelper(7)>
=head1 AUTHORS
pkg-systemd-maintainers@lists.alioth.debian.org
=cut
#!/usr/bin/perl -w
=head1 NAME
dh_systemd_start - start/stop/restart systemd unit files
=cut
use strict;
use Debian::Debhelper::Dh_Lib;
use File::Find;
use Text::ParseWords qw(shellwords); # in core since Perl 5
use Cwd qw(getcwd abs_path);
=head1 SYNOPSIS
B<dh_systemd_start> [S<I<debhelper options>>] [B<--restart-after-upgrade>] [B<--no-restart-on-upgrade>] [S<I<unit file> ...>]
=head1 DESCRIPTION
B<dh_systemd_start> is a debhelper program that is responsible for
starting/stopping or restarting systemd unit files in case no corresponding
sysv init script is available.
As with B<dh_installinit>, the unit file is stopped before
upgrades and started afterwards (unless B<--restart-after-upgrade> is
specified, in which case it will only be restarted after the upgrade).
This logic is not used when there is a corresponding SysV init script
because invoke-rc.d performs the stop/start/restart in that case.
=head1 OPTIONS
=over 4
=item B<--restart-after-upgrade>
Do not stop the unit file until after the package upgrade has been completed.
This is the default behaviour in compat 10.
In earlier compat levels the default was to stop the unit file in the
F<prerm>, and start it again in the F<postinst>.
This can be useful for daemons that should not have a possibly long
downtime during upgrade. But you should make sure that the daemon will not
get confused by the package being upgraded while it's running before using
this option.
=item B<--no-restart-after-upgrade>
Undo a previous B<--restart-after-upgrade> (or the default of compat
10). If no other options are given, this will cause the service to be
stopped in the F<prerm> script and started again in the F<postinst>
script.
=item B<-r>, B<--no-restart-on-upgrade>
Do not stop service on upgrade.
=item B<--no-start>
Do not start the unit file after upgrades and after initial installation (the
latter is only relevant for services without a corresponding init script).
=back
=head1 NOTES
Note that this command is not idempotent. L<dh_prep(1)> should be called
between invocations of this command (with the same arguments). Otherwise, it
may cause multiple instances of the same text to be added to maintainer
scripts.
Note that B<dh_systemd_start> should be run after B<dh_installinit> so that it
can detect corresponding SysV init scripts. The default sequence in B<dh> does
the right thing, this note is only relevant when you are calling
B<dh_systemd_start> manually.
=cut
$dh{RESTART_AFTER_UPGRADE} = 1 if not compat(10);
init(options => {
"r" => \$dh{R_FLAG},
"no-restart-on-upgrade" => \$dh{R_FLAG},
"no-start" => \$dh{NO_START},
"R|restart-after-upgrade!" => \$dh{RESTART_AFTER_UPGRADE},
"no-also" => \$dh{NO_ALSO},
});
# Extracts the Also= or Alias= line(s) from a unit file.
# In case this produces horribly wrong results, you can pass --no-also, but
# that should really not be necessary. Please report bugs to
# pkg-systemd-maintainers.
sub extract_key {
my ($unit_path, $key) = @_;
my @values;
my $fh;
if ($dh{NO_ALSO}) {
return @values;
}
if (!open($fh, '<', $unit_path)) {
warning("Cannot open($unit_path) for extracting the Also= line(s)");
return;
}
while (my $line = <$fh>) {
chomp($line);
if ($line =~ /^\s*$key=(.+)$/i) {
@values = (@values, shellwords($1));
}
}
close($fh);
return @values;
}