4 .
/lib
/functions
/system.sh
5 .
/usr
/share
/libubox
/jshn.sh
13 # Mark image as invalid but still possible to install
14 notify_firmware_invalid
() {
18 # Mark image as broken (impossible to install)
19 notify_firmware_broken
() {
24 # Mark image as incompatible with preserving a backup
25 notify_firmware_no_backup
() {
29 # Add result of validation test
30 notify_firmware_test_result
() {
33 json_set_namespace validate_firmware_image old_ns
34 json_add_boolean
"$1" "$2"
35 json_set_namespace
$old_ns
39 [ "$1" -ne 0 ] && echo 0 ||
echo 1
42 fwtool_check_signature
"$1" >&2
44 [ "$FWTOOL_SIGNATURE" -ne 0 ] && notify_firmware_invalid
46 fwtool_check_image
"$1" >&2
47 FWTOOL_DEVICE_MATCH
=$?
48 [ "$FWTOOL_DEVICE_MATCH" -ne 0 ] && notify_firmware_invalid
50 json_set_namespace validate_firmware_image old_ns
52 json_add_object
"tests"
53 json_add_boolean fwtool_signature
"$(err_to_bool $FWTOOL_SIGNATURE)"
54 json_add_boolean fwtool_device_match
"$(err_to_bool $FWTOOL_DEVICE_MATCH)"
56 # Call platform_check_image() here so it can add its test
57 # results and still mark image properly.
58 json_set_namespace
$old_ns
59 platform_check_image
"$1" >&2 || notify_firmware_invalid
60 json_set_namespace validate_firmware_image old_ns
62 json_add_boolean valid
"$VALID"
63 json_add_boolean forceable
"$FORCEABLE"
64 json_add_boolean allow_backup
"$ALLOW_BACKUP"
66 json_set_namespace
$old_ns