Commit Graph

22 Commits

Author SHA1 Message Date
Michael Biebl
8c0b1a1856 init-functions, getty-static.service: Don't hard-code path to systemctl binary
This should simplify an eventual move of systemctl from /bin to
/usr/bin.
2020-12-26 13:24:58 +01:00
Michael Biebl
7155afaeda init-functions: update LSB hook to not use ignore-dependencies
job-mode=ignore-dependencies, as currently used in the LSB hook during
bootup and shutdown, can have undesired side-effects, like changing the
ordering of services and ultimately causing them to fail, due to unmet
dependencies.
So simplify that, and only apply --no-block on reload requests during
bootup and shutdown.

Closes: #960594
2020-11-18 01:12:08 +01:00
Mert Dirik
3f1c8e9d4c 40-systemd: Don't fail if SysV init script uses set -u and $1 is unset
Closes: #931719
2019-07-18 14:06:29 +02:00
Michael Biebl
e23edb75e4 40-systemd: Use case instead of if statement
Makes it more readable and is also a bit faster.

Gbp-Dch: Ignore
2018-12-01 23:07:47 +01:00
Mert Dirik
f0bee70691 40-systemd: Improve heuristics for init-d-script
Improve heuristics for scripts run via init-d-script so that
the redirection works even for older init-d-script versions
without the __init_d_script_name variable.
2018-12-01 17:41:49 +01:00
Mert Dirik
2a61f775aa 40-systemd: Honour __init_d_script_name
Make /lib/lsb/init-functions.d/40-systemd use __init_d_script_name
(if available) to figure out real script name.

Closes: #826214
2018-12-01 17:41:04 +01:00
Sjoerd Simons
f713edf4a4 init-functions Only call daemon-reload when planning to redirect
systemctl daemon-reload is a quite a heavy operation, it will re-parse
all configuration and re-run all generators. This should only be done
when strictly needed.

The init-function helpers try to cope with an lsb init script being
called *before* the sysv generator has run. Unfortunately that always got
triggered when other script sourced the helpers as there won't be a
service matching them.

Resolve this by only potentially reloading the daemon when preparing to
redirect.

Closes: #861158
2017-04-25 10:04:45 +02:00
Ondřej Nový
dba5fe4ab8 Redirect try-restart in init-functions hook
Closes: #851688
2017-01-18 10:16:08 +01:00
Michael Biebl
ac0552d968 debian/extra/init-functions.d/40-systemd: Rename _SYSTEMCTL_SKIP_REDIRECT
Rename _SYSTEMCTL_SKIP_REDIRECT to SYSTEMCTL_SKIP_REDIRECT to be more
consistent with other environment variables which are used internally by
systemd, like SYSTEMCTL_SKIP_SYSV.
2016-12-22 15:18:47 +01:00
Michael Biebl
af2ba3c62a debian/extra/init-functions.d/40-systemd: Stop setting _SYSTEMCTL_SKIP_REDIRECT=true
It seems we don't actually need it to detect recursive loops (PPID is
sufficient) and by exporting it we leak _SYSTEMCTL_SKIP_REDIRECT into
the runtime environment of the service.

Closes: #802018
2016-12-22 15:13:24 +01:00
Michael Biebl
666e05b238 debian/extra/init-functions.d/40-systemd: Stop checking for init env var
This env variable is no longer set when systemd executes a service so
it's pointless to check for it.
2016-12-22 15:10:53 +01:00
Martin Pitt
fd907eeaee debian/extra/init-functions.d/40-systemd: Do not call systemctl daemon-reload if the script is called as user
reportbug currently does that to determine $is_upstart.

Also make sure that daemon-reload will not invoke polkit.
2016-06-14 10:45:21 +03:00
Martin Pitt
daf04880af debian/extra/init-functions.d/40-systemd: Adjust to changed systemctl show behaviour in 231
Since upstream commit e33a06a1 "systemctl show" fails for nonexisting units
instead of succeeding with "not-found". Make the code compatible to both for
now.
2016-06-01 23:05:54 +02:00
Michael Biebl
c4a61a3cec Add "systemctl daemon-reload" to lsb init-functions hook if the LoadState of a service is "not-found"
This will run systemd-sysv-generator, so SysV init scripts that aren't
installed by the package manager should be picked up automatically.

Closes: #825913
2016-05-31 17:20:06 +02:00
Michael Biebl
d698fd4ceb Use systemctl's new --value switch
to get the CanReload and LoadState property directly.
2016-05-31 17:06:11 +02:00
Martin Pitt
e308302dc0 debian/extra/init-functions.d/40-systemd: Invoke status command with --no-pager
This avoids blocking scripts that call an init.d script with "status" with an
unexpected pager process.

Closes: #765175
LP: #1576409
2016-04-28 22:53:03 +02:00
Michael Biebl
36648cdcc7 Drop "systemctl daemon-reload" from lsb init-functions hook
This is no longer necessary as invoke-rc.d and init-system-helpers take
care of this nowadays.
2016-02-03 04:17:19 +01:00
Andreas Henriksson
92c9b709a4 /lib/lsb/init-functions.d/40-systemd: don't reload masked services
When a service is masked the native service does not support
reload, so the lsb hooks would then allow fallback on init script
reload function.

Move the check for masked services earlier and bail out with exit 0
so that does not happen.

(Still a bit confusing that there's no output at all to inform
the user calling the init script for a masked service about this,
but I've been told it's on purpose eg. to avoid spamming the logs.)

Closes: #804882
2015-12-31 17:31:24 +01:00
Martin Pitt
5377cca2fe /lib/lsb/init-functions.d/40-systemd: Don't ignore systemd unit dependencies in "degraded" mode
LP: #1429734
2015-03-10 08:51:19 +01:00
Martin Pitt
956b720a1d /lib/lsb/init-functions.d/40-systemd: Call systemctl is-system-running with --quiet
LP: #1421058
2015-02-15 16:46:12 +01:00
Martin Pitt
8088ea7297 /lib/lsb/init-functions.d/40-systemd: Avoid deadlocks during bootup and shutdown
DHCP/ifupdown and similar hooks which call "/etc/init.d/foo reload" can easily
cause deadlocks, since the synchronous wait plus systemd's normal behaviour of
transactionally processing all dependencies first easily causes dependency
loops. Thus during boot/shutdown operate only on the unit and not on its
dependencies, just like SysV behaves.

Closes: #777115
LP: #1417010
2015-02-06 15:33:49 +01:00
Martin Pitt
9e1d0901b5 Clean up Debian specific file installation
In debian/rules, remove manual file installation. Move them to
debian/*.install.

Move all Debian specific installed files to debian/extra/.
2015-01-22 09:46:15 +01:00