bootctl: rework/modernize "unlink" and add Varlink API for it
Among other things this changes tracking of the location of resources during GC from using the BootEntrySource enum rather than a path, since we have that and it is more efficient and easier to grok.
This commit is contained in:
@@ -40,8 +40,10 @@ _bootctl() {
|
||||
--dry-run'
|
||||
[ARG]='--esp-path --boot-path --root --image --image-policy --install-source
|
||||
--variables --random-seed --make-entry-directory --entry-token --json
|
||||
--efi-boot-option-description --secure-boot-auto-enroll --private-key
|
||||
--private-key-source --certificate --certificate-source'
|
||||
--efi-boot-option-description --efi-boot-option-description-with-device
|
||||
--secure-boot-auto-enroll --private-key
|
||||
--private-key-source --certificate --certificate-source
|
||||
--oldest'
|
||||
)
|
||||
|
||||
if __contains_word "$prev" ${OPTS[ARG]}; then
|
||||
@@ -67,7 +69,7 @@ _bootctl() {
|
||||
--install-source)
|
||||
comps="image host auto"
|
||||
;;
|
||||
--random-seed|--variables|--secure-boot-auto-enroll)
|
||||
--random-seed|--variables|--secure-boot-auto-enroll|--oldest|--efi-boot-option-description-with-device)
|
||||
comps="yes no"
|
||||
;;
|
||||
--json)
|
||||
@@ -85,7 +87,7 @@ _bootctl() {
|
||||
|
||||
local -A VERBS=(
|
||||
[STANDALONE]='help status install update remove is-installed random-seed list set-timeout set-timeout-oneshot cleanup'
|
||||
[BOOTENTRY]='set-default set-oneshot set-sysfail unlink'
|
||||
[BOOTENTRY]='set-default set-oneshot set-sysfail set-preferred unlink'
|
||||
[BOOLEAN]='reboot-to-firmware'
|
||||
[FILE]='kernel-identify kernel-inspect'
|
||||
)
|
||||
|
||||
@@ -24,10 +24,26 @@ _bootctl_set-oneshot() {
|
||||
_bootctl_comp_ids
|
||||
}
|
||||
|
||||
_bootctl_set-sysfail() {
|
||||
_bootctl_comp_ids
|
||||
}
|
||||
|
||||
_bootctl_set-preferred() {
|
||||
_bootctl_comp_ids
|
||||
}
|
||||
|
||||
_bootctl_unlink() {
|
||||
_bootctl_comp_ids
|
||||
}
|
||||
|
||||
_bootctl_kernel-identify() {
|
||||
_files
|
||||
}
|
||||
|
||||
_bootctl_kernel-inspect() {
|
||||
_files
|
||||
}
|
||||
|
||||
_bootctl_reboot-to-firmware() {
|
||||
local -a _completions
|
||||
_completions=( yes no )
|
||||
@@ -49,10 +65,14 @@ _bootctl_reboot-to-firmware() {
|
||||
"list:List boot loader entries"
|
||||
"set-default:Set the default boot loader entry"
|
||||
"set-oneshot:Set the default boot loader entry only for the next boot"
|
||||
"set-sysfail:Set boot loader entry used in case of a system failure"
|
||||
"set-preferred:Set the preferred boot loader entry"
|
||||
"set-timeout:Set the menu timeout"
|
||||
"set-timeout-oneshot:Set the menu timeout for the next boot only"
|
||||
"unlink:Remove boot loader entry"
|
||||
"cleanup:Remove files in ESP not referenced in any boot entry"
|
||||
"kernel-identify:Identify kernel image type"
|
||||
"kernel-inspect:Print details about the kernel image"
|
||||
)
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands 'bootctl command' _bootctl_cmds || compadd "$@"
|
||||
@@ -79,6 +99,7 @@ _arguments \
|
||||
'--no-pager[Do not pipe output into a pager]' \
|
||||
'--graceful[Do not fail when locating ESP or writing fails]' \
|
||||
'--dry-run[Dry run (unlink and cleanup)]' \
|
||||
'--oldest=[Delete oldest boot menu entry]:options:(yes no)' \
|
||||
'--root=[Operate under the specified directory]:PATH' \
|
||||
'--image=[Operate on the specified image]:PATH' \
|
||||
'--install-source[Where to pick files when using --root=/--image=]:options:(image host auto)' \
|
||||
|
||||
Reference in New Issue
Block a user