4 .
/lib
/functions
/system.sh
5 .
/usr
/share
/libubox
/jshn.sh
12 # Mark image as invalid but still possible to install
13 notify_firmware_invalid
() {
17 # Mark image as broken (impossible to install)
18 notify_firmware_broken
() {
23 # Add result of validation test
24 notify_firmware_test_result
() {
27 json_set_namespace validate_firmware_image old_ns
28 json_add_boolean
"$1" "$2"
29 json_set_namespace
$old_ns
33 [ "$1" -ne 0 ] && echo 0 ||
echo 1
36 fwtool_check_signature
"$1" >&2
38 [ "$FWTOOL_SIGNATURE" -ne 0 ] && notify_firmware_invalid
40 fwtool_check_image
"$1" >&2
41 FWTOOL_DEVICE_MATCH
=$?
42 [ "$FWTOOL_DEVICE_MATCH" -ne 0 ] && notify_firmware_invalid
44 json_set_namespace validate_firmware_image old_ns
46 json_add_object
"tests"
47 json_add_boolean fwtool_signature
"$(err_to_bool $FWTOOL_SIGNATURE)"
48 json_add_boolean fwtool_device_match
"$(err_to_bool $FWTOOL_DEVICE_MATCH)"
50 # Call platform_check_image() here so it can add its test
51 # results and still mark image properly.
52 json_set_namespace
$old_ns
53 platform_check_image
"$1" >&2 || notify_firmware_invalid
54 json_set_namespace validate_firmware_image old_ns
56 json_add_boolean valid
"$VALID"
57 json_add_boolean forceable
"$FORCEABLE"
59 json_set_namespace
$old_ns