Update catwrt-update v2
This commit is contained in:
31
cattools.sh
31
cattools.sh
@@ -477,7 +477,7 @@ debug() {
|
|||||||
|
|
||||||
catwrt_update() {
|
catwrt_update() {
|
||||||
remote_error() {
|
remote_error() {
|
||||||
echo "Remote $1 get failed for arch: $arch_self, please check your network!"
|
echo "Remote $1 get failed for arch: $arch_local, please check your network!"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,12 +486,12 @@ catwrt_update() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
get_remote_hash() {
|
get_remote_info() {
|
||||||
arch_self=$1
|
version_remote=$(curl -s "$API_URL" | jq -r ".[\"$version_local\"].$arch_local.version")
|
||||||
version_remote=$(curl -s "$API_URL" | jq -r ".$arch_self.version")
|
hash_remote=$(curl -s "$API_URL" | jq -r ".[\"$version_local\"].$arch_local.hash")
|
||||||
hash_remote=$(curl -s "$API_URL" | jq -r ".$arch_self.hash")
|
releases_remote=$(curl -s "$API_URL" | jq -r ".[\"$version_local\"].$arch_local.releases")
|
||||||
channel_remote=$(curl -s "$API_URL" | jq -r ".$arch_self.channel")
|
blog_remote=$(curl -s "$API_URL" | jq -r ".[\"$version_local\"].$arch_local.blogs")
|
||||||
blogs_remote=$(echo "$API_URL" | jq -r ".${arch}.blogs")
|
channel_remote=$(curl -s "$API_URL" | jq -r ".[\"$version_local\"].$arch_local.channel")
|
||||||
|
|
||||||
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"
|
||||||
@@ -512,30 +512,27 @@ catwrt_update() {
|
|||||||
contrast_version() {
|
contrast_version() {
|
||||||
if [ "$version_remote" == "$version_local" ] && [ "$hash_remote" == "$hash_local" ]; then
|
if [ "$version_remote" == "$version_local" ] && [ "$hash_remote" == "$hash_local" ]; then
|
||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
echo "Your CatWrt is latest version! Also, you are using $channel_remote channel."
|
echo " Your CatWrt is up to date!"
|
||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
else
|
else
|
||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
echo "Your CatWrt is outdated; you should upgrade it to the latest version!"
|
echo "Your CatWrt is out of date, you should upgrade it!"
|
||||||
echo "Visit '$blogs_remote' for more information."
|
echo "Visit the blog for more information"
|
||||||
|
echo "$blog_remote"
|
||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
print_version() {
|
print_version() {
|
||||||
echo "Remote Hash : $hash_remote"
|
echo "Release : $releases_remote"
|
||||||
echo "Remote Version : $version_remote"
|
echo "Channel : $channel_remote"
|
||||||
echo "Remote Current Channel : $channel_remote"
|
|
||||||
echo "Local Version : $version_local"
|
|
||||||
echo "Local Hash : $hash_local"
|
|
||||||
|
|
||||||
echo "======================================================="
|
echo "======================================================="
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
init
|
init
|
||||||
get_remote_hash "$arch_local"
|
get_remote_info
|
||||||
contrast_version
|
contrast_version
|
||||||
print_version
|
print_version
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user