firmware/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange

43 lines
901 B
Plaintext

# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright 2017 Adrian Schmutzler
. /usr/share/libubox/jshn.sh
. /etc/firmware_release
hoodfiletmp="/tmp/hoodfile"
hoodfileref="/tmp/hoodfileref"
hoodfilewww="/tmp/hoodfilewww"
getJsonPath() {
jsonfile=""
if [ -s "$hoodfilewww" ] ; then
jsonfile="$hoodfilewww"
elif [ -s "$hoodfileref" ] ; then
jsonfile="$hoodfileref"
elif [ -s "$hoodfiletmp" ] ; then
jsonfile="$hoodfiletmp"
fi
echo "$jsonfile"
}
getUpgradePath() {
jsonfile="$(getJsonPath)"
local upgrade_path
if [ -n "$jsonfile" ] ; then
json_load "$(cat "$jsonfile")"
json_select hood
json_get_var upath upgrade_path
upgrade_path="$upath"
else
upgrade_path="http://dev.freifunk-franken.de"
>&2 echo "Upgrade path not set! Falling back to $upgrade_path"
fi
# add full firmware path for current firmwares variant
echo "${upgrade_path}/${VARIANT}/current"
return 0
}