Added option --check-inhibitors for non-tty usage

As described in #2680, systemctl did ignore inhibitors if it is not
attached to a tty to allow scripts to ignore inhibitors automatically.
This pull request preserves this behavior but allows scripts to
explicit check inhibitors if required.

The new parameter '--check-inhibitors=yes' enables this feature.
The old parameter '-i'/'--ignore-inhibitors' was deprecated in favor
of '--check-inhibitors=no', the default behaviour can be specified
with '--check-inhibitors=auto'.
The new parameter is also described in the documentations and shell
completions found here.
This commit is contained in:
Felix Stupp
2021-01-13 16:07:36 +01:00
committed by Lennart Poettering
parent 65ab27211c
commit 4327574fc1
6 changed files with 67 additions and 22 deletions
+5 -2
View File
@@ -125,9 +125,9 @@ _systemctl () {
[STANDALONE]='--all -a --reverse --after --before --defaults --force -f --full -l --global
--help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall --now
--quiet -q --system --user --version --runtime --recursive -r --firmware-setup
--show-types -i --ignore-inhibitors --plain --failed --value --fail --dry-run --wait'
--show-types --plain --failed --value --fail --dry-run --wait'
[ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root
--preset-mode -n --lines -o --output -M --machine --message --timestamp'
--preset-mode -n --lines -o --output -M --machine --message --timestamp --check-inhibitors'
)
if __contains_word "--user" ${COMP_WORDS[*]}; then
@@ -179,6 +179,9 @@ _systemctl () {
--timestamp)
comps='pretty us µs utc us+utc µs+utc'
;;
--check-inhibitors)
comps='auto yes no'
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0