Skip to content

Commit c0cf446

Browse files
committed
flash-gui.sh: add proper checks and cleanup in case of npf rom archive
1 parent eb1032a commit c0cf446

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

initrd/bin/flash-gui.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ while true; do
4343

4444
# is a .npf provided?
4545
if [ -z "${ROM##*.npf}" ]; then
46+
#preventive cleanup
47+
rm -rf /tmp/verified_rom >/dev/null 2>&1 || true
4648
# unzip to /tmp/verified_rom
47-
mkdir /tmp/verified_rom
48-
unzip $ROM -d /tmp/verified_rom
49+
mkdir -p /tmp/verified_rom >/dev/null 2>&1 || true
50+
unzip $ROM -d /tmp/verified_rom || die "Failed to unzip ROM file"
4951
# check file integrity
5052
if (cd /tmp/verified_rom/ && sha256sum -cs /tmp/verified_rom/sha256sum.txt); then
5153
ROM="$(head -n1 /tmp/verified_rom/sha256sum.txt | cut -d ' ' -f 3)"

0 commit comments

Comments
 (0)