You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: initrd/bin/flash-gui.sh
+24-31Lines changed: 24 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ while true; do
33
33
;;
34
34
f | c)
35
35
if (whiptail $BG_COLOR_WARNING --title 'Flash the BIOS with a new ROM' \
36
-
--yesno "You will need to insert a USB drive containing your BIOS image (*.rom or *.tgz).\n\nAfter you select this file, this program will reflash your BIOS.\n\nDo you want to proceed?" 0 80);then
36
+
--yesno "You will need to insert a USB drive containing your BIOS image (*.rom, *.npf or *.tgz).\n\nAfter you select this file, this program will reflash your BIOS.\n\nDo you want to proceed?" 0 80);then
37
37
mount_usb
38
38
if grep -q /media /proc/mounts;then
39
39
find /media ! -path '*/\.*' -type f \( -name '*.rom' -o -name '*.tgz' -o -type f -name '*.npf'\)| sort >/tmp/filelist.txt
@@ -60,41 +60,34 @@ while true; do
60
60
exit
61
61
fi
62
62
else
63
-
# exit if we shall not proceed
63
+
# a rom file is provided. exit if we shall not proceed
64
+
ROM_HASH=$(sha256sum "$ROM"| awk '{print $1}')|| die "Failed to hash ROM file"
64
65
if! (whiptail $CONFIG_ERROR_BG_COLOR --title 'Flash ROM without integrity check?' \
65
-
--yesno "You have provided a *.rom file. The integrity of the file can not be\nchecked automatically for this file.\nIf you do not know how to check the file integrity yourself,\nyou should use a *.npf file instead.\n\nIf the file is damaged, you will not be able to boot anymore.\nDo you want to proceed flashing without file integrity check?"16 60);then
66
+
--yesno "You have provided a *.rom file. The integrity of the file can not be\nchecked automatically for this file.\n\nROM: $ROM\nSHA256SUM: $ROM_HASH\n\nIf you do not know how to check the file integrity yourself,\nyou should use a *.npf file instead.\n\nIf the file is damaged, you will not be able to boot anymore.\nDo you want to proceed flashing without file integrity check?"0 80);then
66
67
exit
67
-
fi
68
+
else
69
+
# then user validated sha256sum manually from has on screen
70
+
ROM_INTEGRITY_VERIFIED=1
71
+
fi
72
+
fi
73
+
74
+
if [ "$ROM_INTEGRITY_VERIFIED"=="1" ];then
75
+
/bin/flash.sh -c -i "$ROM"
76
+
else
77
+
/bin/flash.sh -c "$ROM"
68
78
fi
69
79
70
-
if (whiptail $BG_COLOR_WARNING --title 'Flash ROM?' \
71
-
--yesno "This will replace your current ROM with:\n\n${ROM#"/media/"}\n\nDo you want to proceed?" 0 80);then
72
-
if [ "$menu_choice"=="c" ];then
73
-
# flag is passed to flash.sh to erase settings while stating if rom is verified or not
74
-
if [ "$ROM_INTEGRITY_VERIFIED"=="1" ];then
75
-
/bin/flash.sh -c -i "$ROM"
76
-
else
77
-
/bin/flash.sh -c "$ROM"
78
-
fi
80
+
# after flash, /boot signatures are now invalid so go ahead and clear them
81
+
if ls /boot/kexec*>/dev/null 2>&1;then
82
+
(
83
+
mount -o remount,rw /boot 2>/dev/null
84
+
rm /boot/kexec*2>/dev/null
85
+
mount -o remount,ro /boot 2>/dev/null
86
+
)
87
+
fi
79
88
80
-
# after flash, /boot signatures are now invalid so go ahead and clear them
81
-
if ls /boot/kexec*>/dev/null 2>&1;then
82
-
(
83
-
mount -o remount,rw /boot 2>/dev/null
84
-
rm /boot/kexec*2>/dev/null
85
-
mount -o remount,ro /boot 2>/dev/null
86
-
)
87
-
fi
88
-
else
89
-
if [ "$ROM_INTEGRITY_VERIFIED"=="1" ];then
90
-
# flag is passed to flash.sh to retain settings while stating if rom is verified or not
91
-
/bin/flash.sh "$ROM" -i
92
-
else
93
-
/bin/flash.sh "$ROM"
94
-
fi
95
-
fi
96
-
whiptail --title 'ROM Flashed Successfully' \
97
-
--msgbox "${ROM#"/media/"}\n\nhas been flashed successfully.\n\nPress Enter to reboot\n" 0 80
89
+
if (whiptail --title 'ROM Flashed Successfully' \
90
+
--msgbox "${ROM#"/media/"}\n\nhas been flashed successfully.\n\nPress Enter to reboot\n" 0 80);then
0 commit comments