fix: catwrt-update
This commit is contained in:
42
cattools.sh
42
cattools.sh
@@ -487,12 +487,23 @@ catwrt_update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_remote_info() {
|
get_remote_info() {
|
||||||
local arch_version_json=$(curl -s "$API_URL" | jq -r ".[\"$version_local\"].$arch_local")
|
json_data=$(curl -s "$API_URL")
|
||||||
version_remote=$(echo "$arch_version_json" | jq -r '.version')
|
result=$(echo "$json_data" | jq --arg hash "$hash_local" '
|
||||||
hash_remote=$(echo "$arch_version_json" | jq -r '.hash')
|
. as $root |
|
||||||
releases_remote=$(echo "$arch_version_json" | jq -r '.releases')
|
paths(scalars) as $p |
|
||||||
blog_remote=$(echo "$arch_version_json" | jq -r '.blogs')
|
if getpath($p) == $hash then
|
||||||
channel_remote=$(echo "$arch_version_json" | jq -r '.channel')
|
$p[0] as $version |
|
||||||
|
$p[1] as $device |
|
||||||
|
{version: $version, device: $device} + $root[$version][$device]
|
||||||
|
else empty end
|
||||||
|
| select(.version != null)
|
||||||
|
')
|
||||||
|
|
||||||
|
version_remote=$(echo "$result" | jq -r '.version')
|
||||||
|
channel_remote=$(echo "$result" | jq -r '.channel')
|
||||||
|
blog_remote=$(echo "$result" | jq -r '.blogs')
|
||||||
|
hash_remote=$(echo "$result" | jq -r '.hash')
|
||||||
|
latest=$(echo "$result" | jq -r '.latest')
|
||||||
|
|
||||||
if [ $? -ne 0 ] || [ -z "$version_remote" ] || [ -z "$hash_remote" ]; then
|
if [ $? -ne 0 ] || [ -z "$version_remote" ] || [ -z "$hash_remote" ]; then
|
||||||
remote_error "version or hash"
|
remote_error "version or hash"
|
||||||
@@ -511,23 +522,24 @@ catwrt_update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
contrast_version() {
|
contrast_version() {
|
||||||
if [ "$version_remote" == "$version_local" ] && [ "$hash_remote" == "$hash_local" ]; then
|
if [ "$latest" == "true" ]; then
|
||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
echo " Your CatWrt is $releases_remote"
|
echo " Your CatWrt is up to date!"
|
||||||
|
echo " Remote Channel: $channel_remote"
|
||||||
|
if [ "$channel_remote" == "Beta" ]; then
|
||||||
|
echo " Please watch the latest version changes"
|
||||||
|
else
|
||||||
|
echo " You are on the stable version."
|
||||||
|
fi
|
||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
else
|
else
|
||||||
if [ "$channel_remote" == "Stable" ] || ( [ "$channel_remote" == "Beta" ] && [ "$channel_local" == "Beta" ] ); then
|
|
||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
echo "Your CatWrt is $releases_remote, you should upgrade it!"
|
echo "Your CatWrt is $version_local, the latest version is $version_remote,you should upgrade it!"
|
||||||
echo "Visit the blog for more information"
|
echo "Visit the blog for more information"
|
||||||
echo "$blog_remote"
|
echo "$blog_remote"
|
||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
else
|
|
||||||
echo "======================================================="
|
|
||||||
echo " Your CatWrt is up to date!"
|
|
||||||
echo "======================================================="
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_version() {
|
print_version() {
|
||||||
|
|||||||
Reference in New Issue
Block a user