Update hotupdate

This commit is contained in:
喵二
2024-06-10 16:14:26 +08:00
committed by GitHub
parent 1658e4aa51
commit 8dc434b661

View File

@@ -19,6 +19,42 @@ if ! grep -q "OpenWrt" <<< "$openwrt_release"; then
exit 1
fi
# installed
install_cattools() {
if [ ! -f /usr/bin/cattools ]; then
echo "cattools not found, installing..."
if curl --silent --connect-timeout 5 -o /usr/bin/cattools https://raw.githubusercontent.com/miaoermua/cattools/main/cattools.sh; then
echo "cattools installed successfully from the first URL."
elif curl --silent --connect-timeout 5 -o /usr/bin/cattools https://fastly.jsdelivr.net/gh/miaoermua/cattools@main/cattools.sh; then
echo "cattools installed successfully from the second URL."
else
echo "Failed to download cattools from both URLs."
exit 1
fi
chmod +x /usr/bin/cattools
fi
}
# Update
update_cattools() {
local temp_file=$(mktemp)
if curl --silent --connect-timeout 5 -o "$temp_file" https://raw.githubusercontent.com/miaoermua/cattools/main/cattools.sh; then
echo "cattools update downloaded from the first URL."
elif curl --silent --connect-timeout 5 -o "$temp_file" https://fastly.jsdelivr.net/gh/miaoermua/cattools@main/cattools.sh; then
echo "cattools update downloaded from the second URL."
else
echo "Failed to download updates for cattools from both URLs. Continuing with the existing version."
rm -f "$temp_file"
return
fi
mv "$temp_file" /usr/bin/cattools
chmod +x /usr/bin/cattools
echo "cattools updated successfully."
}
install_cattools
update_cattools
# Menu Function
show_menu() {
echo "----------------------------------------------------------"