mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 14:55:37 +03:00
917e655457
Parses and prints package metadata from executables, libraries and core files $ systemd-analyze inspect-elf /tmp/core ../fsverity-utils/fsverityb /bin/bash --json=off --no-pager __________________________ path: /tmp/core elfType: coredump elfArchitecture: AMD x86-64 module name: /tmp/crash type: deb name: hello version: 1.0 architecture: amd64 os: debian osVersion: 11 buildId: b33541096a09c29a0ba4ec5c69364a2711b7c269 module name: /usr/lib/x86_64-linux-gnu/libc-2.31.so type: deb name: hello version: 1.0 architecture: amd64 os: debian osVersion: 11 buildId: 54eef5ce96cf37cb175b0d93186836ca1caf470c module name: /usr/lib/x86_64-linux-gnu/ld-2.31.so type: deb name: hello version: 1.0 architecture: amd64 os: debian osVersion: 11 buildId: 32438eb3b034da54caf58c7a65446639f7cfe274 __________________________________________________________________ path: /home/luca/git/systemd/../fsverity-utils/fsverity elfType: executable elfArchitecture: AMD x86-64 type: deb name: fsverity-utils version: 1.3-1 architecture: amd64 os: debian debugInfoUrl: https://debuginfod.debian.net buildId: 05b899e6ee0d3653e20458719b202ed3ca8d566f _________________________ path: /bin/bash elfType: executable elfArchitecture: AMD x86-64 buildId: 4fef260f60e257d2dbd4126bf8add83837aea190 $ $ systemd-analyze inspect-elf /tmp/core ../fsverity-utils/fsverity /bin/bash /tmp/core.test-condition.1000.f9b9a84a9fd1482c9702d6afa6f6934b.37640.1637083078000000 --json=pretty --no-pager { "elfType" : "coredump", "elfArchitecture" : "AMD x86-64", "/home/bluca/git/fsverity-utils/fsverity" : { "type" : "deb", "name" : "fsverity-utils", "version" : "1.3-1", "buildId" : "7c895ecd2a271f93e96268f479fdc3c64a2ec4ee" }, "/home/bluca/git/fsverity-utils/libfsverity.so.0" : { "type" : "deb", "name" : "fsverity-utils", "version" : "1.3-1", "buildId" : "b5e428254abf14237b0ae70ed85fffbb98a78f88" } } { "elfType" : "executable", "elfArchitecture" : "AMD x86-64", "/home/bluca/git/systemd/../fsverity-utils/fsverity" : { "type" : "deb", "name" : "fsverity-utils", "version" : "1.3-1", "buildId" : "7c895ecd2a271f93e96268f479fdc3c64a2ec4ee" } } { "elfType" : "executable", "elfArchitecture" : "AMD x86-64", "/bin/bash" : { "buildId" : "3313b4cb119dcce16927a9b6cc61dcd97dfc4d59" } } { "elfType" : "coredump", "elfArchitecture" : "AMD x86-64" }
104 lines
4.8 KiB
Plaintext
104 lines
4.8 KiB
Plaintext
#compdef systemd-analyze
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
(( $+functions[_systemd-analyze_verify] )) ||
|
|
_systemd-analyze_verify() {
|
|
_sd_unit_files
|
|
}
|
|
|
|
(( $+functions[_systemd-analyze_cat-config] )) ||
|
|
_systemd-analyze_cat-config() {
|
|
_files -W '(/run/systemd/ /etc/systemd/ /usr/lib/systemd/)' -P 'systemd/'
|
|
}
|
|
|
|
(( $+functions[_systemd-analyze_security] )) ||
|
|
_systemd-analyze_security() {
|
|
_sd_unit_files
|
|
}
|
|
|
|
(( $+functions[_systemd-analyze_syscall-filter] )) ||
|
|
_systemd-analyze_syscall-filter() {
|
|
local -a _groups
|
|
_groups=( $(systemd-analyze --quiet --no-pager syscall-filter | grep '^@') )
|
|
_describe -t groups 'syscall groups' _groups || compadd "$@"
|
|
}
|
|
|
|
(( $+functions[_systemd-analyze_filesystems] )) ||
|
|
_systemd-analyze_filesystems() {
|
|
local -a _groups
|
|
_groups=( $(systemd-analyze --quiet --no-pager filesystems | grep '^@') )
|
|
_describe -t groups 'file system groups' _groups || compadd "$@"
|
|
}
|
|
|
|
(( $+functions[_systemd-analyze_commands] )) ||
|
|
_systemd-analyze_commands(){
|
|
local -a _systemd_analyze_cmds
|
|
# Descriptions taken from systemd-analyze --help.
|
|
_systemd_analyze_cmds=(
|
|
'time:Print time spent in the kernel before reaching userspace'
|
|
'blame:Print list of running units ordered by time to init'
|
|
'critical-chain:Print a tree of the time critical chain of units'
|
|
'plot:Output SVG graphic showing service initialization'
|
|
'dot:Dump dependency graph (in dot(1) format)'
|
|
'dump:Dump server status'
|
|
'cat-config:Cat systemd config files'
|
|
'unit-files:List files and symlinks for units'
|
|
'unit-paths:List unit load paths'
|
|
'exit-status:List known exit statuses'
|
|
'capability:List capability definitions'
|
|
'syscall-filter:List syscalls in seccomp filters'
|
|
'filesystems:List known filesystems'
|
|
'condition:Evaluate Condition*= and Assert*= assignments'
|
|
'verify:Check unit files for correctness'
|
|
'calendar:Validate repetitive calendar time events'
|
|
'timestamp:Parse a systemd syntax timestamp'
|
|
'timespan:Parse a systemd syntax timespan'
|
|
'security:Analyze security settings of a service'
|
|
'inspect-elf:Parse and print ELF package metadata'
|
|
# log-level, log-target, service-watchdogs have been deprecated
|
|
)
|
|
|
|
if (( CURRENT == 1 )); then
|
|
_describe "options" _systemd_analyze_cmds
|
|
else
|
|
local curcontext="$curcontext"
|
|
cmd="${${_systemd_analyze_cmds[(r)$words[1]:*]%%:*}}"
|
|
if (( $#cmd )); then
|
|
if (( $+functions[_systemd-analyze_$cmd] )) && (( CURRENT == 2 )); then
|
|
_systemd-analyze_$cmd
|
|
else
|
|
_message "no more options"
|
|
fi
|
|
else
|
|
_message "unknown systemd-analyze command: $words[1]"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
_arguments \
|
|
{-h,--help}'[Show help text]' \
|
|
'--version[Show package version]' \
|
|
'--system[Operate on system systemd instance]' \
|
|
'--user[Operate on user systemd instance]' \
|
|
'--global[Show global user instance config]' \
|
|
'--root=[Add support for root argument]:PATH' \
|
|
'--image=[Add support for discrete images]:PATH' \
|
|
'--recursive-errors=[When verifying a unit, control dependency verification]:MODE' \
|
|
'--offline=[Perform a security review of the specified unit files]:BOOL:(yes no)' \
|
|
'--threshold=[Set a value to compare the overall security exposure level with]: NUMBER' \
|
|
'--security-policy=[Allow user to use customized requirements to compare unit file(s) against]: PATH' \
|
|
'--json=[Generate a JSON output of the security analysis table]:MODE:(pretty short off)' \
|
|
'--profile=[Include the specified profile in the security review of the unit(s)]: PATH' \
|
|
'--no-pager[Do not pipe output into a pager]' \
|
|
'--man=[Do (not) check for existence of man pages]:BOOL:(yes no)' \
|
|
'--generators=[Do (not) run unit generators]:BOOL:(yes no)' \
|
|
'--order[When generating graph for dot, show only order]' \
|
|
'--require[When generating graph for dot, show only requirement]' \
|
|
'--fuzz=[When printing the tree of the critical chain, print also services, which finished TIMESPAN earlier, than the latest in the branch]:TIMESPAN' \
|
|
'--from-pattern=[When generating a dependency graph, filter only origins]:GLOB' \
|
|
'--to-pattern=[When generating a dependency graph, filter only destinations]:GLOB' \
|
|
{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
|
|
{-M+,--machine=}'[Operate on local container]:machine:_sd_machines' \
|
|
'--quiet[Do not show hints]' \
|
|
'*::systemd-analyze commands:_systemd-analyze_commands'
|