2017-10-05 15:37:46 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# Copyright 2017 Adrian Schmutzler
|
|
|
|
# License GPLv3
|
|
|
|
|
|
|
|
. /usr/share/libubox/jshn.sh
|
|
|
|
|
2017-10-15 18:00:33 +02:00
|
|
|
getJsonPath() {
|
|
|
|
jsonfile=""
|
2017-10-30 20:02:32 +01:00
|
|
|
if [ -s /www/hood/keyxchangev2data ] ; then
|
|
|
|
jsonfile="/www/hood/keyxchangev2data"
|
2017-10-15 18:00:33 +02:00
|
|
|
elif [ -s /tmp/keyxchangev2data ] ; then
|
|
|
|
jsonfile="/tmp/keyxchangev2data"
|
|
|
|
fi
|
|
|
|
echo "$jsonfile"
|
|
|
|
}
|
|
|
|
|
2017-10-05 15:37:46 +02:00
|
|
|
getUpgradePath() {
|
2017-10-15 18:00:33 +02:00
|
|
|
jsonfile="$(getJsonPath)"
|
|
|
|
|
|
|
|
if [ -n "$jsonfile" ] ; then
|
|
|
|
json_load "$(cat "$jsonfile")"
|
2017-10-05 15:37:46 +02:00
|
|
|
json_select hood
|
|
|
|
json_get_var upath upgrade_path
|
|
|
|
echo "$upath"
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|