2024-06-10 16:20:10 +08:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
# Check ROOT & OpenWrt
|
|
|
|
|
|
if [ $(id -u) != "0" ]; then
|
|
|
|
|
|
echo "Error: You must be root to run this script, please use root user"
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
openwrt_release=$(cat /etc/openwrt_release)
|
|
|
|
|
|
if ! grep -q "OpenWrt" <<< "$openwrt_release"; then
|
|
|
|
|
|
echo "Your system is not supported!"
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# installed
|
|
|
|
|
|
install_cattools() {
|
|
|
|
|
|
if [ ! -f /usr/bin/cattools ]; then
|
|
|
|
|
|
echo "cattools not found, installing..."
|
2025-01-21 16:58:32 +08:00
|
|
|
|
if curl --silent --connect-timeout 5 -o /usr/bin/cattools https://raw.miaoer.net/cattools/cattools.sh; then
|
2024-06-10 16:20:10 +08:00
|
|
|
|
echo "cattools installed successfully from the first URL."
|
2024-07-31 18:18:26 +08:00
|
|
|
|
elif curl --silent --connect-timeout 5 -o /usr/bin/cattools https://raw.githubusercontent.com/miaoermua/cattools/main/cattools.sh; then
|
2024-06-10 16:20:10 +08:00
|
|
|
|
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
|
|
|
|
|
|
echo "cattools is installed successfully!"
|
|
|
|
|
|
echo "please type ‘cattools’ or ‘/usr/bin/cattools’ to run it."
|
|
|
|
|
|
}
|
2024-07-08 20:56:33 +08:00
|
|
|
|
|
|
|
|
|
|
install_cattools
|