sysinstall: new component

This commit is contained in:
Lennart Poettering
2026-05-05 15:09:47 +02:00
committed by Lennart Poettering
parent ea07d7fec3
commit 5fbc7a7b12
15 changed files with 1911 additions and 0 deletions
+1
View File
@@ -54,6 +54,7 @@ foreach item : [
['systemd-resolve', 'ENABLE_RESOLVE'],
['systemd-run', ''],
['systemd-sysext', 'ENABLE_SYSEXT'],
['systemd-sysinstall', 'ENABLE_SYSINSTALL'],
['systemd-vmspawn', 'ENABLE_VMSPAWN'],
['systemd-vpick', ''],
['timedatectl', 'ENABLE_TIMEDATED'],
+90
View File
@@ -0,0 +1,90 @@
# shellcheck shell=bash
# systemd-sysinstall(8) completion -*- shell-script -*-
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <https://www.gnu.org/licenses/>.
__contains_word() {
local w word=$1; shift
for w in "$@"; do
[[ $w = "$word" ]] && return
done
}
__get_block_devices() {
systemd-repart --list-devices 2>/dev/null
}
_systemd_sysinstall() {
local comps
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword
local -A OPTS=(
[STANDALONE]='-h --help --version'
[ARG]='--welcome
--chrome
--erase
--confirm
--summary
--reboot
--variables
--mute-console
--copy-locale
--copy-keymap
--copy-timezone
--definitions
--kernel
--set-credential
--load-credential'
)
_init_completion || return
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--welcome|--chrome|--confirm|--summary|--reboot|--mute-console|--copy-locale|--copy-keymap|--copy-timezone)
comps='yes no'
;;
--erase|--variables)
comps='yes no auto'
;;
--definitions)
comps=$(compgen -A directory -- "$cur")
compopt -o filenames
;;
--kernel|--load-credential)
comps=$(compgen -A file -- "$cur")
compopt -o filenames
;;
--set-credential)
comps=''
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
fi
if [[ "$cur" = -* ]]; then
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
return 0
fi
comps=$(__get_block_devices)
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
compopt -o filenames
return 0
}
complete -F _systemd_sysinstall systemd-sysinstall
+29
View File
@@ -0,0 +1,29 @@
#compdef systemd-sysinstall
# SPDX-License-Identifier: LGPL-2.1-or-later
(( $+functions[_systemd-sysinstall_devices] )) ||
_systemd-sysinstall_devices() {
local -a _devices
_devices=( ${(f)"$(systemd-repart --list-devices 2>/dev/null)"} )
_wanted devices expl 'block device' compadd -a _devices
}
_arguments \
'(- *)'{-h,--help}'[Show help text]' \
'(- *)--version[Show package version]' \
'--welcome=[Show welcome text]:boolean:(yes no)' \
'--chrome=[Show colored bars at top and bottom of the terminal]:boolean:(yes no)' \
'--erase=[Erase target disk before installation]:boolean:(yes no auto)' \
'--confirm=[Query for confirmation before installation]:boolean:(yes no)' \
'--summary=[Show summary before installation]:boolean:(yes no)' \
'--reboot=[Reboot system after installation]:boolean:(yes no)' \
'--variables=[Register installation in firmware variables]:boolean:(yes no auto)' \
'--mute-console=[Mute kernel/PID 1 console output during installation]:boolean:(yes no)' \
'--copy-locale=[Copy current locale to target system]:boolean:(yes no)' \
'--copy-keymap=[Copy current keymap to target system]:boolean:(yes no)' \
'--copy-timezone=[Copy current timezone to target system]:boolean:(yes no)' \
'--definitions=[Find partition definitions in directory]:directory:_directories' \
'--kernel=[Kernel image to install]:kernel image:_files' \
'--set-credential=[Install a credential with a literal value]: : _message "ID:VALUE"' \
'--load-credential=[Load credential from a file or AF_UNIX socket]: : _message "ID:PATH"' \
'*::block device:_systemd-sysinstall_devices'
+1
View File
@@ -43,6 +43,7 @@ foreach item : [
['_systemd-nspawn', ''],
['_systemd-path', ''],
['_systemd-run', ''],
['_systemd-sysinstall', 'ENABLE_SYSINSTALL'],
['_systemd-tmpfiles', 'ENABLE_TMPFILES'],
['_timedatectl', 'ENABLE_TIMEDATED'],
['_udevadm', ''],