Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide better error feedback when upgrades fail 01/05/2023 #621

Merged
merged 1 commit into from Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 15 additions & 6 deletions files/usr/local/bin/firmwarecheck.sh
Expand Up @@ -5,11 +5,20 @@

include /lib/upgrade/

if (eval platform_check_image "$*")
if $(platform_check_image "$*" > /dev/null 2>&1)
then
return 0;
else
return 1;
json=$(/usr/libexec/validate_firmware_image "$*" 2> /dev/null)
if [ "$(echo "$json" | jsonfilter -e '@.value')" = "true" ]; then
return 0;
fi
if [ "$(echo "$json" | jsonfilter -e '@.tests.fwtool_signature')" = "false" ]; then
echo "firmware signature failed"
return 1;
fi
if [ "$(echo "$json" | jsonfilter -e '@.tests.fwtool_device_match')" = "false" ]; then
echo "firmware device match failed";
return 1
fi
fi


echo "platform check image failed";
return 1
5 changes: 3 additions & 2 deletions files/www/cgi-bin/admin
Expand Up @@ -348,9 +348,10 @@ if parms.button_ul_fw and nixio.fs.stat("/tmp/web/upload/file") then
-- drop the page cache to take pressure off tmps when checking the firmware
write_all("/proc/sys/vm/drop_caches", "3")
-- check firmware header
if os.execute("/usr/local/bin/firmwarecheck.sh " .. tmpdir .. "/firmware > /dev/null 2>&1") ~= 0 then
local fcheck = capture("/usr/local/bin/firmwarecheck.sh " .. tmpdir .. "/firmware")
if fcheck ~= "" then
fwout("Firmware CANNOT be updated")
fwout("firmware file is not valid")
fwout("firmware file is not valid: " .. fcheck)
fw_install = false
nixio.fs.remove(tmpdir .. "/firmware")
if os.execute("/usr/local/bin/uploadctlservices restore > /dev/null 2>&1") ~= 0 then
Expand Down