Skip to content

Commit 6bc673d

Browse files
committed
gpg-gui, oem-factory-reset, config-gui: add --no-backup to trusted flash calls
These callers write only CBFS-level changes (GPG keys, user config, OEM setup image) rather than user-selected firmware updates. Saving a rollback backup before these writes is incorrect: the backup would contain the same firmware the caller is about to re-flash with minor CBFS modifications, and the pending_rollback marker would spuriously trigger the auto-rollback countdown on the next boot. Add --no-backup to suppress both the backup read and the pending_rollback marker for: gpg-gui.sh gpg_flash_rom() - GPG key reflash oem-factory-reset OEM setup image reflash config-gui.sh save-config reflash (3 call sites: save user config, factory reset, disable restricted boot) Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent 4a92886 commit 6bc673d

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

initrd/bin/config-gui.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ while true; do
175175

176176
if (whiptail --title 'Update ROM?' \
177177
--yesno "This will reflash your BIOS with the updated version\n\nDo you want to proceed?" 0 80); then
178-
/bin/flash.sh /tmp/config-gui.rom
178+
/bin/flash.sh --no-backup /tmp/config-gui.rom
179179
whiptail --title 'BIOS Updated Successfully' \
180180
--msgbox "BIOS updated successfully.\n\nIf your keys have changed, be sure to re-sign all files in /boot\nafter you reboot.\n\nPress Enter to reboot" 0 80
181181
/bin/reboot
@@ -205,7 +205,7 @@ while true; do
205205
cbfs.sh -o /tmp/config-gui.rom -d $i
206206
done
207207
# flash cleared ROM
208-
/bin/flash.sh -c /tmp/config-gui.rom
208+
/bin/flash.sh -c --no-backup /tmp/config-gui.rom
209209

210210
# reset TPM if present
211211
if [ "$CONFIG_TPM" = "y" ]; then
@@ -394,7 +394,7 @@ while true; do
394394

395395
replace_rom_file /tmp/config-gui.rom "heads/initrd/etc/config.user" "$FLASH_USER_CONFIG"
396396

397-
/bin/flash.sh /tmp/config-gui.rom
397+
/bin/flash.sh --no-backup /tmp/config-gui.rom
398398
whiptail --title 'BIOS Updated Successfully' \
399399
--msgbox "BIOS updated successfully.\n\nIf your keys have changed, be sure to re-sign all files in /boot\nafter you reboot.\n\nPress Enter to reboot" 0 80
400400
/bin/reboot

initrd/bin/gpg-gui.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ gpg_flash_rom() {
6060
if [ -e /etc/config.user ]; then
6161
cbfs.sh -o /tmp/gpg-gui.rom -a "heads/initrd/etc/config.user" -f /etc/config.user
6262
fi
63-
/bin/flash.sh /tmp/gpg-gui.rom
63+
/bin/flash.sh --no-backup /tmp/gpg-gui.rom
6464

6565
if (whiptail --title 'BIOS Flashed Successfully' \
6666
--yesno "Would you like to update the checksums and sign all of the files in /boot?\n\nYou will need your GPG key to continue and this will modify your disk.\n\nOtherwise the system will reboot immediately." 0 80) then

initrd/bin/oem-factory-reset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ else
14151415

14161416
# flash updated firmware image
14171417
echo -e "\nAdding generated key to current firmware and re-flashing...\n"
1418-
if ! /bin/flash.sh /tmp/oem-setup.rom 2>/tmp/error; then
1418+
if ! /bin/flash.sh --no-backup /tmp/oem-setup.rom 2>/tmp/error; then
14191419
ERROR=$(tail -n 1 /tmp/error | fold -s)
14201420
whiptail_error_die "Error flashing updated firmware image:\n\n$ERROR"
14211421
fi

0 commit comments

Comments
 (0)