1 #compdef bootctl -*- shell-script -*-
2 # SPDX-License-Identifier: LGPL-2.1+
5 bootctl --no-pager $@ 2>/dev/null
11 __bootctl list | while read a b; do
12 if [[ "$a" == "id:" ]]; then
16 _wanted id expl 'boot id' compadd "$@" -a ids
19 _bootctl_set-default() {
23 _bootctl_set-oneshot() {
27 (( $+functions[_bootctl_commands] )) || _bootctl_commands()
29 local -a _bootctl_cmds
31 "status:Show status of installed systemd-boot and EFI variables"
32 "install:Install systemd-boot to the ESP and EFI variables"
33 "update:Update systemd-boot in the ESP and EFI variables"
34 "remove:Remove systemd-boot from the ESP and EFI variables"
35 "random-seed:Initialize random seed in ESP and EFI variables"
36 "is-installed:Test whether systemd-boot is installed in the ESP"
37 "set-default:Set the default boot loader entry"
38 "set-oneshot:Set the default boot loader entry only for the next boot"
40 if (( CURRENT == 1 )); then
41 _describe -t commands 'bootctl command' _bootctl_cmds || compadd "$@"
43 local curcontext="$curcontext"
44 cmd="${${_bootctl_cmds[(r)$words[1]:*]%%:*}}"
45 if (( $+functions[_bootctl_$cmd] )); then
48 _message "no more options"
54 {-h,--help}'[Prints a short help text and exits.]' \
55 '--version[Prints a short version string and exits.]' \
56 '--esp-path=[Path to the EFI System Partition (ESP)]:path:_directories' \
57 '--boot-path=[Path to the $BOOT partition]:path:_directories' \
58 {-p,--print-esp-path}'[Print path to the EFI system partition]' \
59 {-x,--print-boot-path}'[Print path to the $BOOT partition]' \
60 '--no-variables[Do not touch EFI variables]' \
61 '--no-pager[Do not pipe output into a pager]' \
62 '*::bootctl command:_bootctl_commands'