Update nodeloc_vps_autotest.sh

This commit is contained in:
Jensfrank 2024-06-26 15:29:50 +08:00 committed by GitHub
parent 22f9831b77
commit f81ce6916f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,6 +6,16 @@ GREEN='\033[0;32m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
# 检查 root 权限并获取 sudo 权限
if [ "$(id -u)" != "0" ]; then
echo "此脚本需要 root 权限运行。"
if ! sudo -v; then
echo "无法获取 sudo 权限,退出脚本。"
exit 1
fi
echo "已获取 sudo 权限。"
fi
#更新系统 #更新系统
update_system() { update_system() {
if command -v apt &>/dev/null; then if command -v apt &>/dev/null; then