Update cattools.sh
This commit is contained in:
17
cattools.sh
17
cattools.sh
@@ -41,11 +41,10 @@ install_cattools() {
|
|||||||
|
|
||||||
chmod +x "$CATTOOLS_PATH"
|
chmod +x "$CATTOOLS_PATH"
|
||||||
echo "cattools 安装成功。"
|
echo "cattools 安装成功。"
|
||||||
echo ""
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# HotUpdate
|
# Hotupdate
|
||||||
check_for_updates() {
|
check_for_updates() {
|
||||||
local UPDATE_URLS=(
|
local UPDATE_URLS=(
|
||||||
"https://raw.githubusercontent.com/miaoermua/cattools/main/cattools.sh"
|
"https://raw.githubusercontent.com/miaoermua/cattools/main/cattools.sh"
|
||||||
@@ -57,19 +56,23 @@ check_for_updates() {
|
|||||||
for URL in "${UPDATE_URLS[@]}"; do
|
for URL in "${UPDATE_URLS[@]}"; do
|
||||||
if curl -m 5 -s -o "$TEMP_FILE" "$URL"; then
|
if curl -m 5 -s -o "$TEMP_FILE" "$URL"; then
|
||||||
if [ -s "$TEMP_FILE" ]; then
|
if [ -s "$TEMP_FILE" ]; then
|
||||||
echo "更新已找到,替换当前脚本..."
|
echo "更新已找到,替换当前脚本..."
|
||||||
mv "$TEMP_FILE" "$0"
|
mv "$TEMP_FILE" "$0"
|
||||||
chmod +x "$0"
|
chmod +x "$0"
|
||||||
exec "$0" "$@"
|
exec "$0" "$@"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f "$TEMP_FILE"
|
rm -f "$TEMP_FILE"
|
||||||
echo "没有找到更新,继续运行当前脚本..."
|
echo "没有找到更新,继续运行当前脚本..."
|
||||||
echo ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_for_updates
|
||||||
|
|
||||||
|
install_cattools
|
||||||
|
|
||||||
|
|
||||||
# Menu Function
|
# Menu Function
|
||||||
show_menu() {
|
show_menu() {
|
||||||
echo "----------------------------------------------------------"
|
echo "----------------------------------------------------------"
|
||||||
@@ -286,10 +289,6 @@ use_repo(){
|
|||||||
opkg update
|
opkg update
|
||||||
}
|
}
|
||||||
|
|
||||||
install_cattools
|
|
||||||
|
|
||||||
check_for_updates
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
show_menu
|
show_menu
|
||||||
read choice
|
read choice
|
||||||
|
|||||||
Reference in New Issue
Block a user