mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
meson: sort shell completions and exit earlier when shell completion is disabled (#39816)
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
bashcompletiondir = get_option('bashcompletiondir')
|
||||
if bashcompletiondir == ''
|
||||
if bashcompletiondir == 'no'
|
||||
subdir_done()
|
||||
elif bashcompletiondir == ''
|
||||
bash_completion = dependency('bash-completion', required : false)
|
||||
if bash_completion.found()
|
||||
bashcompletiondir = bash_completion.get_variable(pkgconfig : 'completionsdir')
|
||||
@@ -14,50 +16,51 @@ custom_target(
|
||||
input : 'systemctl.in',
|
||||
output : 'systemctl',
|
||||
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
|
||||
install : bashcompletiondir != 'no',
|
||||
install : true,
|
||||
install_dir : bashcompletiondir)
|
||||
|
||||
items = [['busctl', ''],
|
||||
['journalctl', ''],
|
||||
['systemd-analyze', ''],
|
||||
['systemd-cat', ''],
|
||||
['systemd-cgls', ''],
|
||||
['systemd-cgtop', ''],
|
||||
['systemd-creds', ''],
|
||||
['systemd-delta', ''],
|
||||
['systemd-detect-virt', ''],
|
||||
['systemd-id128', ''],
|
||||
['systemd-nspawn', 'ENABLE_NSPAWN'],
|
||||
['systemd-path', ''],
|
||||
['systemd-run', ''],
|
||||
['systemd-vpick', ''],
|
||||
['udevadm', ''],
|
||||
['bootctl', ''],
|
||||
['run0', ''],
|
||||
['varlinkctl', ''],
|
||||
['coredumpctl', 'ENABLE_COREDUMP'],
|
||||
['homectl', 'ENABLE_HOMED'],
|
||||
['hostnamectl', 'ENABLE_HOSTNAMED'],
|
||||
['importctl', 'ENABLE_IMPORTD'],
|
||||
['kernel-install', 'ENABLE_KERNEL_INSTALL'],
|
||||
['localectl', 'ENABLE_LOCALED'],
|
||||
['loginctl', 'ENABLE_LOGIND'],
|
||||
['machinectl', 'ENABLE_MACHINED'],
|
||||
['networkctl', 'ENABLE_NETWORKD'],
|
||||
['oomctl', 'ENABLE_OOMD'],
|
||||
['portablectl', 'ENABLE_PORTABLED'],
|
||||
['resolvectl', 'ENABLE_RESOLVE'],
|
||||
['systemd-cryptenroll', 'HAVE_LIBCRYPTSETUP'],
|
||||
['systemd-confext', 'ENABLE_SYSEXT'],
|
||||
['systemd-dissect', 'HAVE_BLKID'],
|
||||
['systemd-resolve', 'ENABLE_RESOLVE'],
|
||||
['systemd-sysext', 'ENABLE_SYSEXT'],
|
||||
['systemd-vmspawn', 'ENABLE_VMSPAWN'],
|
||||
['timedatectl', 'ENABLE_TIMEDATED'],
|
||||
['userdbctl', 'ENABLE_USERDB']]
|
||||
foreach item : [
|
||||
['bootctl', ''],
|
||||
['busctl', ''],
|
||||
['coredumpctl', 'ENABLE_COREDUMP'],
|
||||
['homectl', 'ENABLE_HOMED'],
|
||||
['hostnamectl', 'ENABLE_HOSTNAMED'],
|
||||
['importctl', 'ENABLE_IMPORTD'],
|
||||
['journalctl', ''],
|
||||
['kernel-install', 'ENABLE_KERNEL_INSTALL'],
|
||||
['localectl', 'ENABLE_LOCALED'],
|
||||
['loginctl', 'ENABLE_LOGIND'],
|
||||
['machinectl', 'ENABLE_MACHINED'],
|
||||
['networkctl', 'ENABLE_NETWORKD'],
|
||||
['oomctl', 'ENABLE_OOMD'],
|
||||
['portablectl', 'ENABLE_PORTABLED'],
|
||||
['resolvectl', 'ENABLE_RESOLVE'],
|
||||
['run0', ''],
|
||||
['systemd-analyze', ''],
|
||||
['systemd-cat', ''],
|
||||
['systemd-cgls', ''],
|
||||
['systemd-cgtop', ''],
|
||||
['systemd-confext', 'ENABLE_SYSEXT'],
|
||||
['systemd-creds', ''],
|
||||
['systemd-cryptenroll', 'HAVE_LIBCRYPTSETUP'],
|
||||
['systemd-delta', ''],
|
||||
['systemd-detect-virt', ''],
|
||||
['systemd-dissect', 'HAVE_BLKID'],
|
||||
['systemd-id128', ''],
|
||||
['systemd-nspawn', 'ENABLE_NSPAWN'],
|
||||
['systemd-path', ''],
|
||||
['systemd-resolve', 'ENABLE_RESOLVE'],
|
||||
['systemd-run', ''],
|
||||
['systemd-sysext', 'ENABLE_SYSEXT'],
|
||||
['systemd-vmspawn', 'ENABLE_VMSPAWN'],
|
||||
['systemd-vpick', ''],
|
||||
['timedatectl', 'ENABLE_TIMEDATED'],
|
||||
['udevadm', ''],
|
||||
['userdbctl', 'ENABLE_USERDB'],
|
||||
['varlinkctl', ''],
|
||||
]
|
||||
|
||||
foreach item : items
|
||||
if bashcompletiondir != 'no' and (item[1] == '' or conf.get(item[1]) == 1)
|
||||
if item[1] == '' or conf.get(item[1]) == 1
|
||||
install_data(item[0],
|
||||
install_dir : bashcompletiondir)
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
zshcompletiondir = get_option('zshcompletiondir')
|
||||
if zshcompletiondir == ''
|
||||
if zshcompletiondir == 'no'
|
||||
subdir_done()
|
||||
elif zshcompletiondir == ''
|
||||
zshcompletiondir = datadir / 'zsh/site-functions'
|
||||
endif
|
||||
|
||||
@@ -9,41 +11,42 @@ custom_target(
|
||||
input : '_systemctl.in',
|
||||
output : '_systemctl',
|
||||
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
|
||||
install : zshcompletiondir != 'no',
|
||||
install : true,
|
||||
install_dir : zshcompletiondir)
|
||||
|
||||
items = [['_busctl', ''],
|
||||
['_journalctl', ''],
|
||||
['_systemd-analyze', ''],
|
||||
['_systemd-delta', ''],
|
||||
['_systemd-nspawn', ''],
|
||||
['_systemd', ''],
|
||||
['_systemd-path', ''],
|
||||
['_systemd-run', ''],
|
||||
['_run0', ''],
|
||||
['_udevadm', ''],
|
||||
['_varlinkctl', ''],
|
||||
['_kernel-install', 'ENABLE_KERNEL_INSTALL'],
|
||||
['_sd_bus_address', ''],
|
||||
['_sd_hosts_or_user_at_host', ''],
|
||||
['_sd_outputmodes', ''],
|
||||
['_sd_unit_files', ''],
|
||||
['_sd_machines', ''],
|
||||
['_bootctl', ''],
|
||||
['_coredumpctl', 'ENABLE_COREDUMP'],
|
||||
['_hostnamectl', 'ENABLE_HOSTNAMED'],
|
||||
['_localectl', 'ENABLE_LOCALED'],
|
||||
['_loginctl', 'ENABLE_LOGIND'],
|
||||
['_machinectl', 'ENABLE_MACHINED'],
|
||||
['_networkctl', 'ENABLE_NETWORKD'],
|
||||
['_oomctl', 'ENABLE_OOMD'],
|
||||
['_systemd-inhibit', 'ENABLE_LOGIND'],
|
||||
['_resolvectl', 'ENABLE_RESOLVE'],
|
||||
['_systemd-tmpfiles', 'ENABLE_TMPFILES'],
|
||||
['_timedatectl', 'ENABLE_TIMEDATED']]
|
||||
foreach item : [
|
||||
['_bootctl', ''],
|
||||
['_busctl', ''],
|
||||
['_coredumpctl', 'ENABLE_COREDUMP'],
|
||||
['_hostnamectl', 'ENABLE_HOSTNAMED'],
|
||||
['_journalctl', ''],
|
||||
['_kernel-install', 'ENABLE_KERNEL_INSTALL'],
|
||||
['_localectl', 'ENABLE_LOCALED'],
|
||||
['_loginctl', 'ENABLE_LOGIND'],
|
||||
['_machinectl', 'ENABLE_MACHINED'],
|
||||
['_networkctl', 'ENABLE_NETWORKD'],
|
||||
['_oomctl', 'ENABLE_OOMD'],
|
||||
['_resolvectl', 'ENABLE_RESOLVE'],
|
||||
['_run0', ''],
|
||||
['_sd_bus_address', ''],
|
||||
['_sd_hosts_or_user_at_host', ''],
|
||||
['_sd_machines', ''],
|
||||
['_sd_outputmodes', ''],
|
||||
['_sd_unit_files', ''],
|
||||
['_systemd', ''],
|
||||
['_systemd-analyze', ''],
|
||||
['_systemd-delta', ''],
|
||||
['_systemd-inhibit', 'ENABLE_LOGIND'],
|
||||
['_systemd-nspawn', ''],
|
||||
['_systemd-path', ''],
|
||||
['_systemd-run', ''],
|
||||
['_systemd-tmpfiles', 'ENABLE_TMPFILES'],
|
||||
['_timedatectl', 'ENABLE_TIMEDATED'],
|
||||
['_udevadm', ''],
|
||||
['_varlinkctl', ''],
|
||||
]
|
||||
|
||||
foreach item : items
|
||||
if zshcompletiondir != 'no' and (item[1] == '' or conf.get(item[1]) == 1)
|
||||
if item[1] == '' or conf.get(item[1]) == 1
|
||||
install_data(item[0],
|
||||
install_dir : zshcompletiondir)
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user