Commit 0cb1789d authored by Lorenzo Faletra's avatar Lorenzo Faletra

Import Debian version 1.49+parrot1

init-system-helpers (1.49+parrot1) testing; urgency=medium

  * Import new Debian release.
  * Reinclude parrot patches.

init-system-helpers (1.49) unstable; urgency=low

  [ Felipe Sateler ]
  * Upload to unstable. Urgency low due to large changeset.
  * d-s-invoke: Execute systemctl once when starting units.
    This ensures systemd itself can order them the best way it sees fit.
    (Closes: #848192)
  * update-rc.d: check that /etc/insserv.conf exists before invoking insserv.
    It might happen that the binary exists but the configuration file doesn't,
    and then the insserv invocation will fail. Therefore don't consider insserv
    installed until the configuration file exists.
    Thanks to Petter Reinholdtsen for the patch. (Closes: #849284)
  * Bump Standards-Version

  [ Iain Lane ]
  * invoke-rc.d: Pass --full to `systemctl status', so we don't get ellipsised output.

  [ Michael Biebl ]
  * Drop support for upstart

init-system-helpers (1.48) unstable; urgency=medium

  * Team upload
  * [fbabdc8] Handle units with escaped characters correctly.
    See
    https://www.freedesktop.org/software/systemd/man/systemd-escape.html
    for details. (Closes: #861204)
parent 8a21e1cc
init-system-helpers (1.49+parrot1) testing; urgency=medium
* Import new Debian release.
* Reinclude parrot patches.
-- Lorenzo "Palinuro" Faletra <palinuro@parrotsec.org> Fri, 25 Aug 2017 00:42:03 +0200
init-system-helpers (1.49) unstable; urgency=low
[ Felipe Sateler ]
* Upload to unstable. Urgency low due to large changeset.
* d-s-invoke: Execute systemctl once when starting units.
This ensures systemd itself can order them the best way it sees fit.
(Closes: #848192)
* update-rc.d: check that /etc/insserv.conf exists before invoking insserv.
It might happen that the binary exists but the configuration file doesn't,
and then the insserv invocation will fail. Therefore don't consider insserv
installed until the configuration file exists.
Thanks to Petter Reinholdtsen for the patch. (Closes: #849284)
* Bump Standards-Version
[ Iain Lane ]
* invoke-rc.d: Pass --full to `systemctl status', so we don't get ellipsised output.
[ Michael Biebl ]
* Drop support for upstart
-- Felipe Sateler <fsateler@debian.org> Mon, 17 Jul 2017 12:27:32 -0400
init-system-helpers (1.48) unstable; urgency=medium
* Team upload
* [fbabdc8] Handle units with escaped characters correctly.
See
https://www.freedesktop.org/software/systemd/man/systemd-escape.html
for details. (Closes: #861204)
-- Bernd Zeimetz <bzed@debian.org> Tue, 02 May 2017 12:20:21 +0200
init-system-helpers (1.47+parrot4) testing; urgency=medium
* Enable resolvconf.
......
Source: init-system-helpers
Section: admin
Priority: extra
Maintainer: Parrot Devel Team <parrot-devel@lists.parrotsec.org>
Uploaders: Lorenzo "Palinuro" Faletra <palinuro@parrotsec.org>
Maintainer: Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>
Uploaders: Michael Biebl <biebl@debian.org>,
Martin Pitt <mpitt@debian.org>,
Felipe Sateler <fsateler@debian.org>
Build-Depends: debhelper (>= 9),
perl:any,
Standards-Version: 3.9.8
Standards-Version: 4.0.0
Vcs-Git: https://anonscm.debian.org/git/collab-maint/init-system-helpers.git
Vcs-Browser: https://anonscm.debian.org/git/collab-maint/init-system-helpers.git
......
......@@ -3,4 +3,3 @@ script/deb-systemd-invoke usr/bin
script/invoke-rc.d usr/sbin
script/service usr/sbin
script/update-rc.d usr/sbin
systemd/99-parrot-blacklist.preset usr/lib/systemd/system-preset
......@@ -32,17 +32,16 @@ service \- run a System V init script
.SH DESCRIPTION
.B service
runs a System V init script, systemd unit, or upstart job in as predictable an
runs a System V init script or systemd unit in as predictable an
environment as possible, removing most environment variables and with the
current working directory set to \fB/\fR.
The
.I SCRIPT
parameter specifies a System V init script,
located in \fB/etc/init.d/\fISCRIPT\fR, or the name of a systemd unit, or the
name of an upstart job in \fB/etc/init\fR. The existence of a systemd unit or
upstart job of the same name as a script in /etc/init.d will cause the unit/job
to take precedence over the init.d script.
located in \fB/etc/init.d/\fISCRIPT\fR, or the name of a systemd unit.
The existence of a systemd unit of the same name as a script in /etc/init.d
will cause the unit to take precedence over the init.d script.
The supported values of
.I COMMAND
depend on the invoked script.
......@@ -51,11 +50,9 @@ passes
.I COMMAND
and
.I OPTIONS
to the init script unmodified. For systemd units or upstart jobs, start, stop,
to the init script unmodified. For systemd units, start, stop,
status, and reload are passed through to their systemctl/initctl
equivalents. For upstart jobs, restart will call the upstart 'stop' for the
job, followed immediately by the 'start', and will exit with the return code of
the start command.
equivalents.
All scripts should support at least the
.B start
......@@ -68,16 +65,14 @@ is \fB\-\-full-restart\fR, the script is run twice, first with the
.B stop
command, then with the
.B start
command. This option has no effect on upstart jobs.
command.
.B service \-\-status\-all
runs all init scripts, in alphabetical order, with the
.B status
command. The status is [ + ] for running services, [ - ] for stopped
services and [ ? ] for services without a 'status' command. This
option only calls status for sysvinit jobs; upstart jobs can be
queried in a similar manner with
\fBinitctl list\fR.
option only calls status for sysvinit jobs.
.SH EXIT CODES
.BR service
......@@ -88,9 +83,6 @@ calls the init script and returns the status returned by it.
\fB/etc/init.d\fR
The directory containing System V init scripts.
.TP
\fB/etc/init\fR
The directory containing upstart jobs.
.TP
\fB/{lib,run,etc}/systemd/system\fR
The directories containing systemd units.
......@@ -109,5 +101,3 @@ The only environment variables passed to the init scripts.
.BR invoke\-rc.d (8).
.br
.BR systemctl (1).
.br
.BR initctl (8).
......@@ -83,9 +83,10 @@ if (-x $policyhelper) {
# We don't autostart static units either.
if ($action eq "start" || $action eq "restart") {
my $global_exit_code = 0;
my @start_units = ();
for my $unit (@units) {
my $unit_installed = 0;
my $enabled_output = `/bin/systemctl is-enabled -- $unit`;
my $enabled_output = `/bin/systemctl is-enabled -- '$unit'`;
# matching enabled and enabled-runtime as an installed non static unit
if ($enabled_output =~ /enabled/) {
$unit_installed = 1;
......@@ -98,15 +99,13 @@ if ($action eq "start" || $action eq "restart") {
print STDERR "$unit is a disabled or a static unit not running, not starting it.\n";
}
else {
system('/bin/systemctl', "$action", "$unit");
my $exit_code = $?>>8;
if ($exit_code != 0) {
print STDERR "$unit couldn't $action.\n";
$global_exit_code = $exit_code;
}
push @start_units, $unit;
}
}
exit($global_exit_code);
if (@start_units) {
exec('/bin/systemctl', $action, @start_units) or die("Could not execute systemctl: $!");
}
exit(0);
} else {
exec '/bin/systemctl', @ARGV;
}
......@@ -36,7 +36,6 @@ FORCE=
RETRY=
RETURNFAILURE=
RC=
is_upstart=
is_systemd=
is_openrc=
......@@ -266,15 +265,7 @@ fi
#NOTE: It may not be obvious, but "$@" from this point on must expand
#to the extra initscript parameters, except inside functions.
# Operate against system upstart, not session
unset UPSTART_SESSION
# If we're running on upstart and there's an upstart job of this name, do
# the rest with upstart instead of calling the init script.
if which initctl >/dev/null && initctl version 2>/dev/null | grep -q upstart \
&& initctl status ${INITSCRIPTID} 1>/dev/null 2>/dev/null
then
is_upstart=1
elif test -d /run/systemd/system ; then
if test -d /run/systemd/system ; then
is_systemd=1
UNIT="${INITSCRIPTID%.sh}.service"
elif test -f /run/openrc/softlevel ; then
......@@ -283,13 +274,6 @@ elif test ! -f "${INITDPREFIX}${INITSCRIPTID}" ; then
## Verifies if the given initscript ID is known
## For sysvinit, this error is critical
printerror unknown initscript, ${INITDPREFIX}${INITSCRIPTID} not found.
# If the init script doesn't exist, but the upstart job does, we
# defer the error exit; we might be running in a chroot and
# policy-rc.d might say not to start the job anyway, in which case
# we don't want to exit non-zero.
if [ ! -e "/etc/init/${INITSCRIPTID}.conf" ]; then
exit 100
fi
fi
## Queries sysvinit for the current runlevel
......@@ -422,9 +406,7 @@ fi
# test if /etc/init.d/initscript is actually executable
_executable=
if [ -n "$is_upstart" ]; then
_executable=1
elif [ -n "$is_systemd" ]; then
if [ -n "$is_systemd" ]; then
_executable=1
elif testexec "${INITDPREFIX}${INITSCRIPTID}"; then
_executable=1
......@@ -476,22 +458,11 @@ getnextaction () {
ACTION="$@"
}
if [ -n "$is_upstart" ]; then
RUNNING=
DISABLED=
if status "$INITSCRIPTID" 2>/dev/null | grep -q ' start/'; then
RUNNING=1
fi
if ! initctl show-config -e "$INITSCRIPTID" | grep -q '^ start on'; then
DISABLED=1
fi
fi
## Executes initscript
## note that $ACTION is a space-separated list of actions
## to be attempted in order until one suceeds.
if test x${FORCE} != x || test ${RC} -eq 104 ; then
if [ -n "$is_upstart" ] || [ -n "$is_systemd" ] || testexec "${INITDPREFIX}${INITSCRIPTID}" ; then
if [ -n "$is_systemd" ] || testexec "${INITDPREFIX}${INITSCRIPTID}" ; then
RC=102
setechoactions ${ACTION}
while test ! -z "${ACTION}" ; do
......@@ -500,46 +471,7 @@ if test x${FORCE} != x || test ${RC} -eq 104 ; then
printerror executing initscript action \"${saction}\"...
fi
if [ -n "$is_upstart" ]; then
case $saction in
status)
"$saction" "$INITSCRIPTID" && exit 0
;;
start|stop)
if [ -z "$RUNNING" ] && [ "$saction" = "stop" ]; then
exit 0
elif [ -n "$RUNNING" ] && [ "$saction" = "start" ]; then
exit 0
elif [ -n "$DISABLED" ] && [ "$saction" = "start" ]; then
exit 0
fi
$saction "$INITSCRIPTID" && exit 0
;;
restart)
if [ -n "$RUNNING" ] ; then
stop "$INITSCRIPTID"
fi
# If the job is disabled and is not currently
# running, the job is not restarted. However, if
# the job is disabled but has been forced into
# the running state, we *do* stop and restart it
# since this is expected behaviour
# for the admin who forced the start.
if [ -n "$DISABLED" ] && [ -z "$RUNNING" ]; then
exit 0
fi
start "$INITSCRIPTID" && exit 0
;;
reload|force-reload)
reload "$INITSCRIPTID" && exit 0
;;
*)
# This will almost certainly fail, but give it a try
initctl "$saction" "$INITSCRIPTID" && exit 0
;;
esac
elif [ -n "$is_systemd" ]; then
if [ -n "$is_systemd" ]; then
if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ]; then
# If we are called by a maintainer script, chances are good that a
# new or updated sysv init script was installed. Reload daemon to
......@@ -604,7 +536,7 @@ if test x${FORCE} != x || test ${RC} -eq 104 ; then
done
printerror initscript ${INITSCRIPTID}, action \"${saction}\" failed.
if [ -n "$is_systemd" ] && [ "$saction" = start -o "$saction" = restart -o "$saction" = "try-restart" ]; then
systemctl status --no-pager "${UNIT}" || true
systemctl status --full --no-pager "${UNIT}" || true
fi
exit ${RC}
fi
......
......@@ -129,29 +129,6 @@ while [ $# -gt 0 ]; do
esac
done
# Operate against system upstart, not session
unset UPSTART_SESSION
if [ -r "/etc/init/${SERVICE}.conf" ] && which initctl >/dev/null \
&& initctl version 2>/dev/null | grep -q upstart \
&& initctl status ${SERVICE} 2>/dev/null 1>/dev/null
then
# Upstart configuration exists for this job and we're running on upstart
case "${ACTION}" in
start|stop|status|reload)
# Action is a valid upstart action
exec ${ACTION} ${SERVICE} ${OPTIONS}
;;
restart|force-reload)
# Map restart to the usual sysvinit behavior.
# Map force-reload to restart as per Debian policy 9.3.2,
# since there is no way to know if "reload" is supported
stop ${SERVICE} ${OPTIONS} || :
exec start ${SERVICE} ${OPTIONS}
;;
esac
fi
run_via_sysvinit() {
# Otherwise, use the traditional sysvinit
if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
......
......@@ -166,50 +166,6 @@ sub make_systemd_links {
}
}
# Manage the .override file for upstart jobs, so update-rc.d enable/disable
# work on upstart systems the same as on sysvinit/systemd.
sub upstart_toggle {
my ($scriptname, $action) = @_;
# This needs to be done by manually parsing .override files instead of
# using initctl, because upstart might not be installed yet.
my $service_path;
if (-f "/etc/init/$scriptname.conf") {
$service_path = "/etc/init/$scriptname.override";
}
if (!defined($service_path)) {
return;
}
my $fh;
my $enabled = 1;
my $overrides = '';
if (open $fh, '<', $service_path) {
while (<$fh>) {
if (/^\s*manual\s*$/) {
$enabled = 0;
} else {
$overrides .= $_;
}
}
}
close($fh);
if ($enabled && $action eq 'disable') {
open $fh, '>>', $service_path or error("unable to write $service_path");
print $fh "manual\n";
close($fh);
} elsif (!$enabled && $action eq 'enable') {
if ($overrides ne '') {
open $fh, '>', $service_path . '.new' or error ("unable to write $service_path");
print $fh $overrides;
close($fh);
rename($service_path . '.new', $service_path) or error($!);
} else {
unlink($service_path) or error($!);
}
}
}
## Dependency based
sub insserv_updatercd {
my @args = @_;
......@@ -239,9 +195,11 @@ sub insserv_updatercd {
my $insserv = "/usr/lib/insserv/insserv";
# Fallback for older insserv package versions [2014-04-16]
$insserv = "/sbin/insserv" if ( -x "/sbin/insserv");
# If insserv is not configured it is not fully installed
my $insserv_installed = -x $insserv && -e "/etc/insserv.conf";
if ("remove" eq $action) {
system("rc-update", "-qqa", "delete", $scriptname) if ( -x "/sbin/openrc" );
if ( ! -x $insserv) {
if ( !$insserv_installed ) {
# We are either under systemd or in a chroot where the link priorities don't matter
make_sysv_links($scriptname, "remove");
systemd_reload;
......@@ -275,7 +233,7 @@ sub insserv_updatercd {
cmp_args_with_defaults($scriptname, $action, @args);
}
if ( ! -x $insserv) {
if ( !$insserv_installed ) {
# We are either under systemd or in a chroot where the link priorities don't matter
make_sysv_links($scriptname, "defaults");
systemd_reload;
......@@ -307,11 +265,9 @@ sub insserv_updatercd {
} elsif ("disable" eq $action || "enable" eq $action) {
make_systemd_links($scriptname, $action);
upstart_toggle($scriptname, $action);
sysv_toggle($notreally, $action, $scriptname, @args);
if ( ! -x $insserv) {
if ( !$insserv_installed ) {
# We are either under systemd or in a chroot where the link priorities don't matter
systemd_reload;
exit 0;
......
disable apache2.service
disable avahi-daemon.service
disable couchdb.service
disable clamav-daemon.service
disable clamav-freshclam.service
disable cups.service
disable dictd.service
disable dhcpcd.service
disable dradis.service
disable exim4.service
disable greenbone-security-assistant.service
disable iodined.service
disable mariadb.service
disable minissdpd.service
disable openbsd-inetd.service
disable openvas-manager.service
disable openvas-scanner.service
disable polipo.service
disable postfix.service
disable postgresql.service
disable pppd-dns.service
disable procmail.service
disable redis-server.service
disable rpcbind.service
disable saned.service
disable ssh.service
disable stunnel4.service
disable winbind.service
disable thin.service
disable tinyproxy.service
disable tor.service
disable udftools.service
disable pure-ftpd.service
disable *
enable resolvconf.service
......@@ -54,7 +54,7 @@ unless ($ENV{'TEST_ON_REAL_SYSTEM'}) {
# ┃ Verify “is-enabled” is not true for a random, non-existing unit file. ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
my ($fh, $random_unit) = tempfile('unitXXXXX',
my ($fh, $random_unit) = tempfile('unit\x2dXXXXX',
SUFFIX => '.service',
TMPDIR => 1,
UNLINK => 1);
......@@ -303,13 +303,13 @@ ExecStart=/bin/sleep 1
[Install]
WantedBy=multi-user.target
Alias=footest.service
Alias=foo\x2dtest.service
EOT
close($fh);
isnt_enabled($random_unit);
isnt_enabled('footest.service');
my $alias_path = "/etc/systemd/system/footest.service";
isnt_enabled('foo\x2dtest.service');
my $alias_path = "/etc/systemd/system/foo\x2dtest.service";
ok(! -l $alias_path, 'alias link does not exist yet');
$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
is($retval, 0, "enable command succeeded");
......@@ -376,7 +376,7 @@ EOT
close($fh);
isnt_enabled($random_unit);
isnt_enabled('footest.service');
isnt_enabled('foo\x2dtest.service');
# note that in this case $alias_path and $mask_path are identical
$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
is($retval, 0, "enable command succeeded");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment