Use "new" --job-mode= option in more places
--irreversible/--ignore-dependencies/--fail are deprececated since 4dc5b821ae
.
Also add shell completions for --jobs-mode.
This commit is contained in:
parent
c18d201808
commit
903e7c37ca
|
@ -1522,7 +1522,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Shut down and halt the system. This is mostly equivalent to
|
<para>Shut down and halt the system. This is mostly equivalent to
|
||||||
<command>start halt.target --irreversible</command>, but also
|
<command>start halt.target --job-mode=replace-irreversibly</command>, but also
|
||||||
prints a wall message to all users. If combined with
|
prints a wall message to all users. If combined with
|
||||||
<option>--force</option>, shutdown of all running services is
|
<option>--force</option>, shutdown of all running services is
|
||||||
skipped, however all processes are killed and all file
|
skipped, however all processes are killed and all file
|
||||||
|
@ -1538,7 +1538,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Shut down and power-off the system. This is mostly
|
<para>Shut down and power-off the system. This is mostly
|
||||||
equivalent to <command>start poweroff.target --irreversible</command>,
|
equivalent to <command>start poweroff.target --job-mode=replace-irreversibly</command>,
|
||||||
but also prints a wall message to all users. If combined with
|
but also prints a wall message to all users. If combined with
|
||||||
<option>--force</option>, shutdown of all running services is
|
<option>--force</option>, shutdown of all running services is
|
||||||
skipped, however all processes are killed and all file
|
skipped, however all processes are killed and all file
|
||||||
|
@ -1554,7 +1554,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Shut down and reboot the system. This is mostly
|
<para>Shut down and reboot the system. This is mostly
|
||||||
equivalent to <command>start reboot.target --irreversible</command>,
|
equivalent to <command>start reboot.target --job-mode=replace-irreversibly</command>,
|
||||||
but also prints a wall message to all users. If combined with
|
but also prints a wall message to all users. If combined with
|
||||||
<option>--force</option>, shutdown of all running services is
|
<option>--force</option>, shutdown of all running services is
|
||||||
skipped, however all processes are killed and all file
|
skipped, however all processes are killed and all file
|
||||||
|
@ -1581,7 +1581,7 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Shut down and reboot the system via kexec. This is
|
<para>Shut down and reboot the system via kexec. This is
|
||||||
mostly equivalent to <command>start kexec.target --irreversible</command>,
|
mostly equivalent to <command>start kexec.target --job-mode=replace-irreversibly</command>,
|
||||||
but also prints a wall message to all users. If combined
|
but also prints a wall message to all users. If combined
|
||||||
with <option>--force</option>, shutdown of all running
|
with <option>--force</option>, shutdown of all running
|
||||||
services is skipped, however all processes are killed and
|
services is skipped, however all processes are killed and
|
||||||
|
|
|
@ -90,10 +90,10 @@ _systemctl () {
|
||||||
local i verb comps mode
|
local i verb comps mode
|
||||||
|
|
||||||
local -A OPTS=(
|
local -A OPTS=(
|
||||||
[STANDALONE]='--all -a --reverse --after --before --defaults --fail --ignore-dependencies --failed --force -f --full -l --global
|
[STANDALONE]='--all -a --reverse --after --before --defaults --failed --force -f --full -l --global
|
||||||
--help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall
|
--help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall
|
||||||
--quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup'
|
--quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup'
|
||||||
[ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --root'
|
[ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root'
|
||||||
)
|
)
|
||||||
|
|
||||||
if __contains_word "--user" ${COMP_WORDS[*]}; then
|
if __contains_word "--user" ${COMP_WORDS[*]}; then
|
||||||
|
@ -115,6 +115,10 @@ _systemctl () {
|
||||||
active inactive
|
active inactive
|
||||||
dead elapsed exited listening mounted plugged running waiting'
|
dead elapsed exited listening mounted plugged running waiting'
|
||||||
;;
|
;;
|
||||||
|
--job-mode)
|
||||||
|
comps='fail replace replace-irreversibly isolate
|
||||||
|
ignore-dependencies ignore-requirements flush'
|
||||||
|
;;
|
||||||
--kill-who)
|
--kill-who)
|
||||||
comps='all control main'
|
comps='all control main'
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -353,11 +353,18 @@ _unit_properties() {
|
||||||
_values -s , "${_sys_all_properties[@]}"
|
_values -s , "${_sys_all_properties[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_job_modes() {
|
||||||
|
local -a _modes
|
||||||
|
_modes=(fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush)
|
||||||
|
_values -s , "${_modes[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
_arguments -s \
|
_arguments -s \
|
||||||
{-h,--help}'[Show help]' \
|
{-h,--help}'[Show help]' \
|
||||||
'--version[Show package version]' \
|
'--version[Show package version]' \
|
||||||
{-t+,--type=}'[List only units of a particular type]:unit type:_unit_types' \
|
{-t+,--type=}'[List only units of a particular type]:unit type:_unit_types' \
|
||||||
'--state=[Display units in the specifyied state]:unit state:_unit_states' \
|
'--state=[Display units in the specified state]:unit state:_unit_states' \
|
||||||
|
'--job-mode=[Specify how to deal with other jobs]:mode:_job_modes' \
|
||||||
{-p+,--property=}'[Show only properties by specific name]:unit property:_unit_properties' \
|
{-p+,--property=}'[Show only properties by specific name]:unit property:_unit_properties' \
|
||||||
{-a,--all}'[Show all units/properties, including dead/empty ones]' \
|
{-a,--all}'[Show all units/properties, including dead/empty ones]' \
|
||||||
'--reverse[Show reverse dependencies]' \
|
'--reverse[Show reverse dependencies]' \
|
||||||
|
@ -365,10 +372,7 @@ _arguments -s \
|
||||||
'--before[Show units ordered before]' \
|
'--before[Show units ordered before]' \
|
||||||
'--failed[Show only failed units]' \
|
'--failed[Show only failed units]' \
|
||||||
{-l,--full}"[Don't ellipsize unit names on output]" \
|
{-l,--full}"[Don't ellipsize unit names on output]" \
|
||||||
'--fail[When queueing a new job, fail if conflicting jobs are pending]' \
|
|
||||||
'--show-types[When showing sockets, show socket type]' \
|
'--show-types[When showing sockets, show socket type]' \
|
||||||
'--irreversible[Mark transactions as irreversible]' \
|
|
||||||
'--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \
|
|
||||||
{-i,--ignore-inhibitors}'[When executing a job, ignore jobs dependencies]' \
|
{-i,--ignore-inhibitors}'[When executing a job, ignore jobs dependencies]' \
|
||||||
{-q,--quiet}'[Suppress output]' \
|
{-q,--quiet}'[Suppress output]' \
|
||||||
'--no-block[Do not wait until operation finished]' \
|
'--no-block[Do not wait until operation finished]' \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash -x
|
#!/bin/bash -x
|
||||||
|
|
||||||
# Test merging of a --ignore-dependencies job into a previously
|
# Test merging of a --job-mode=ignore-dependencies job into a previously
|
||||||
# installed job.
|
# installed job.
|
||||||
|
|
||||||
systemctl start --no-block hello-after-sleep.target
|
systemctl start --no-block hello-after-sleep.target
|
||||||
|
@ -11,7 +11,7 @@ grep 'hello\.service.*waiting' /root/list-jobs.txt || exit 1
|
||||||
|
|
||||||
# This is supposed to finish quickly, not wait for sleep to finish.
|
# This is supposed to finish quickly, not wait for sleep to finish.
|
||||||
START_SEC=$(date -u '+%s')
|
START_SEC=$(date -u '+%s')
|
||||||
systemctl start --ignore-dependencies hello
|
systemctl start --job-mode=ignore-dependencies hello
|
||||||
END_SEC=$(date -u '+%s')
|
END_SEC=$(date -u '+%s')
|
||||||
ELAPSED=$(($END_SEC-$START_SEC))
|
ELAPSED=$(($END_SEC-$START_SEC))
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ systemctl stop sleep.service hello-after-sleep.target || exit 1
|
||||||
systemctl start --no-block hello-after-sleep.target || exit 1
|
systemctl start --no-block hello-after-sleep.target || exit 1
|
||||||
# hello.service should still be waiting, so these try-restarts will collapse
|
# hello.service should still be waiting, so these try-restarts will collapse
|
||||||
# into NOPs.
|
# into NOPs.
|
||||||
systemctl try-restart --fail hello.service || exit 1
|
systemctl try-restart --job-mode=fail hello.service || exit 1
|
||||||
systemctl try-restart hello.service || exit 1
|
systemctl try-restart hello.service || exit 1
|
||||||
systemctl stop hello.service sleep.service hello-after-sleep.target || exit 1
|
systemctl stop hello.service sleep.service hello-after-sleep.target || exit 1
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ systemctl start unstoppable.service || exit 1
|
||||||
# This is expected to fail with 'job cancelled'
|
# This is expected to fail with 'job cancelled'
|
||||||
systemctl stop unstoppable.service && exit 1
|
systemctl stop unstoppable.service && exit 1
|
||||||
# But this should succeed
|
# But this should succeed
|
||||||
systemctl stop --irreversible unstoppable.service || exit 1
|
systemctl stop --job-mode=replace-irreversibly unstoppable.service || exit 1
|
||||||
|
|
||||||
# We're going to shutdown soon. Let's see if it succeeds when
|
# We're going to shutdown soon. Let's see if it succeeds when
|
||||||
# there's an active service that tries to be unstoppable.
|
# there's an active service that tries to be unstoppable.
|
||||||
|
|
|
@ -18,7 +18,7 @@ Environment=HOME=/root
|
||||||
WorkingDirectory=/root
|
WorkingDirectory=/root
|
||||||
ExecStartPre=-/bin/plymouth quit
|
ExecStartPre=-/bin/plymouth quit
|
||||||
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.'
|
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.'
|
||||||
ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default"
|
ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default"
|
||||||
Type=idle
|
Type=idle
|
||||||
StandardInput=tty-force
|
StandardInput=tty-force
|
||||||
StandardOutput=inherit
|
StandardOutput=inherit
|
||||||
|
|
|
@ -18,7 +18,7 @@ Environment=HOME=/root
|
||||||
WorkingDirectory=/root
|
WorkingDirectory=/root
|
||||||
ExecStartPre=-/bin/plymouth quit
|
ExecStartPre=-/bin/plymouth quit
|
||||||
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.'
|
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.'
|
||||||
ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default"
|
ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default"
|
||||||
Type=idle
|
Type=idle
|
||||||
StandardInput=tty-force
|
StandardInput=tty-force
|
||||||
StandardOutput=inherit
|
StandardOutput=inherit
|
||||||
|
|
Loading…
Reference in New Issue