When qemu reboots instead of shutting down after the last iteration,
the profile is already set to profile2 but the /root/encrypted.raw is
gone so the test fails. Reset the default boot entry at the end of the
test to make it robust against reruns.
Fixes https://github.com/systemd/systemd/issues/39553
elif [[ "$ID" == "profile2" ]]; then
grep testprofile2=1 /proc/cmdline
rm /root/encrypted.raw
+ # Reset the default boot entry so a subsequent re-run of the test does not
+ # boot straight back into @profile2 (where encrypted.raw is now gone) and fail.
+ bootctl set-default ""
else
exit 1
fi