2013-12-09 21:25:13 -07:00
|
|
|
#!/bin/sh
|
2015-01-18 12:36:49 -07:00
|
|
|
# Copyright 2014 Conrad Lara
|
|
|
|
|
2015-03-22 00:03:24 -06:00
|
|
|
. /lib/functions.sh
|
2013-12-09 21:25:13 -07:00
|
|
|
|
|
|
|
include /lib/upgrade/
|
|
|
|
|
2023-01-05 17:37:39 -07:00
|
|
|
if $(platform_check_image "$*" > /dev/null 2>&1)
|
2013-12-09 21:25:13 -07:00
|
|
|
then
|
2023-01-05 17:37:39 -07:00
|
|
|
json=$(/usr/libexec/validate_firmware_image "$*" 2> /dev/null)
|
2023-01-06 21:38:54 -07:00
|
|
|
if [ "$(echo "$json" | jsonfilter -e '@.valid')" = "true" ]; then
|
2023-01-05 17:37:39 -07:00
|
|
|
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
|
2023-03-10 16:39:23 -07:00
|
|
|
if [ -f /tmp/force-upgrade-this-is-dangerous ]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
echo "firmware device match failed";
|
|
|
|
return 1
|
|
|
|
fi
|
2023-01-05 17:37:39 -07:00
|
|
|
fi
|
2013-12-09 21:25:13 -07:00
|
|
|
fi
|
2023-01-05 17:37:39 -07:00
|
|
|
echo "platform check image failed";
|
|
|
|
return 1
|