services: convert to VERB_COMMAND and add --introspect-cli
This converts systemd-homed, -hostnamed, -importd, -localed, -logind, -machined, -networkd, -portebled, -resolved, -sysupdated, -timedated, and -timesyncd. The service name and description move from service_parse_argv() arguments into a COMMAND() description that each daemon now defines. The service_parse_argv() macro captures the calling binary's verb section, where that COMMAND is found, while the options are still defined and parsed in libshared, in the new "service" option namespace that each COMMAND references. (The named namespace makes sure that options defined by other translation units in libshared can never leak into the services' parsers.) The supported features are declared via option group filtering: each COMMAND lists "Options" plus "Bus introspection" and/or "Runtime scope". Unsupported options are now rejected by the parser as unknown options (and are not shown in --help), replacing the runtime "This service does not support …" errors. The help output changes slightly: the "Bus introspection" and "Runtime scope" option groups now get their own headings, and some descriptions were reworded to the imperative form used elsewhere.
This commit is contained in:
@@ -66,25 +66,32 @@ INTROSPECTABLE=(
|
||||
systemd-firstboot
|
||||
systemd-growfs
|
||||
systemd-hibernate-resume
|
||||
systemd-homed
|
||||
systemd-hostnamed
|
||||
systemd-hwdb
|
||||
systemd-id128
|
||||
systemd-imds
|
||||
systemd-imdsd
|
||||
systemd-import
|
||||
systemd-import-fs
|
||||
systemd-importd
|
||||
systemd-inhibit
|
||||
systemd-integritysetup
|
||||
systemd-journal-gatewayd
|
||||
systemd-journal-remote
|
||||
systemd-journal-upload
|
||||
systemd-keyutil
|
||||
systemd-localed
|
||||
systemd-logind
|
||||
systemd-machine-id-setup
|
||||
systemd-machined
|
||||
systemd-measure
|
||||
systemd-modules-load
|
||||
systemd-mount
|
||||
systemd-mstack
|
||||
systemd-mute-console
|
||||
systemd-network-generator
|
||||
systemd-networkd
|
||||
systemd-networkd-wait-online
|
||||
systemd-notify
|
||||
systemd-nspawn
|
||||
@@ -92,6 +99,7 @@ INTROSPECTABLE=(
|
||||
systemd-path
|
||||
systemd-pcrextend
|
||||
systemd-pcrlock
|
||||
systemd-portabled
|
||||
systemd-pty-forward
|
||||
systemd-pull
|
||||
systemd-random-seed
|
||||
@@ -102,6 +110,7 @@ INTROSPECTABLE=(
|
||||
systemd-report-files
|
||||
systemd-report-sign-plain
|
||||
systemd-report-sign-tsm
|
||||
systemd-resolved
|
||||
systemd-run
|
||||
systemd-sbsign
|
||||
systemd-sleep
|
||||
@@ -116,7 +125,10 @@ INTROSPECTABLE=(
|
||||
systemd-sysext
|
||||
systemd-sysinstall
|
||||
systemd-sysupdate
|
||||
systemd-sysupdated
|
||||
systemd-sysusers
|
||||
systemd-timedated
|
||||
systemd-timesyncd
|
||||
systemd-tmpfiles
|
||||
systemd-tpm2-clear
|
||||
systemd-tpm2-setup
|
||||
@@ -181,6 +193,14 @@ systemd-clonesetup --introspect-cli | jq -e \
|
||||
systemd-dissect --introspect-cli | jq -e \
|
||||
'[.commands[].names[0]] | sort == ["mount.ddi", "systemd-dissect"]'
|
||||
|
||||
# systemd-hostnamed does not support --system/--user: options from groups not listed by the
|
||||
# command must be rejected as unknown and hidden from the introspection (option group filtering)
|
||||
if command -v systemd-hostnamed >/dev/null; then
|
||||
(! systemd-hostnamed --system 2>&1) | grep "unrecognized option" >/dev/null
|
||||
systemd-hostnamed --introspect-cli | jq -e \
|
||||
'all(.commands[]; all(.options[]; .names[-1] != "--system"))'
|
||||
fi
|
||||
|
||||
systemd-id128 --introspect-cli | jq -e \
|
||||
'.commands[0].verbs | map(.names[0]) | contains(["new", "machine-id", "show", "help"])'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user