bootctl: accept makeEntryDirectory in Install Varlink method

The CLI defaults --make-entry-directory to off and lets callers opt in
or request auto mode. The Varlink Install method always ran in auto
mode with no way to override it. Expose the tri-state so IPC callers
can match the CLI behaviour.
This commit is contained in:
r-vdp
2026-07-02 17:34:26 +02:00
parent ca7fd21cf3
commit e2cda710c1
3 changed files with 28 additions and 9 deletions
+17 -1
View File
@@ -459,9 +459,25 @@ testcase_install_varlink() {
FAKE_BOOT="$(mktemp --directory /tmp/test-bootctl-boot.XXXXXXXXXX)"
SYSTEMD_RELAX_ESP_CHECKS=yes SYSTEMD_RELAX_XBOOTLDR_CHECKS=yes SYSTEMD_LOG_TARGET=console \
varlinkctl call --quiet "$(type -p bootctl)" io.systemd.BootControl.Install \
"{\"operation\":\"new\",\"touchVariables\":false,\"espPath\":\"$FAKE_ESP\",\"xbootldrPath\":\"$FAKE_BOOT\"}"
"{\"operation\":\"new\",\"touchVariables\":false,\"espPath\":\"$FAKE_ESP\",\"xbootldrPath\":\"$FAKE_BOOT\",\"makeEntryDirectory\":false}"
test -f "$FAKE_ESP/EFI/systemd/systemd-boot$(bootctl --print-efi-architecture).efi"
test -f "$FAKE_BOOT/loader/entries.srel"
# makeEntryDirectory:false means loader.conf must not gain a "default" line and no entry
# token directory is created under $BOOT.
(! grep '^default ' "$FAKE_ESP/loader/loader.conf" >/dev/null)
# Same again into fresh directories with makeEntryDirectory:true, and check loader.conf now
# gets a "default <entry-token>-*" line and the entry token directory shows up under $BOOT.
rm -rf "$FAKE_ESP" "$FAKE_BOOT"
FAKE_ESP="$(mktemp --directory /tmp/test-bootctl-esp.XXXXXXXXXX)"
FAKE_BOOT="$(mktemp --directory /tmp/test-bootctl-boot.XXXXXXXXXX)"
SYSTEMD_RELAX_ESP_CHECKS=yes SYSTEMD_RELAX_XBOOTLDR_CHECKS=yes SYSTEMD_LOG_TARGET=console \
varlinkctl call --quiet "$(type -p bootctl)" io.systemd.BootControl.Install \
"{\"operation\":\"new\",\"touchVariables\":false,\"espPath\":\"$FAKE_ESP\",\"xbootldrPath\":\"$FAKE_BOOT\",\"makeEntryDirectory\":true}"
local TOKEN
TOKEN="$(sed -n 's/^default \(.*\)-\*$/\1/p' "$FAKE_ESP/loader/loader.conf")"
test -n "$TOKEN"
test -d "$FAKE_BOOT/$TOKEN"
}
cleanup_link() {