Update install.sh

This commit is contained in:
wnlen
2026-03-20 14:31:37 +08:00
parent f42600f2e5
commit 5ad062af88

View File

@ -93,7 +93,7 @@ section() {
# 前置校验
# =========================
if [ "$(id -u)" -ne 0 ]; then
err "需要 root 权限执行安装脚本(请使用 sudo bash install.sh"
err "需要 root 权限执行安装脚本(请使用 bash install.sh"
exit 1
fi
@ -390,7 +390,7 @@ PROFILED_FILE="/etc/profile.d/clash-for-linux.sh"
install_profiled() {
local install_dir="$Install_Dir"
sudo tee "$PROFILED_FILE" >/dev/null <<EOF
tee "$PROFILED_FILE" >/dev/null <<EOF
# Clash for Linux proxy helpers
# Auto-generated by clash-for-linux installer.
@ -439,7 +439,7 @@ proxy_status() {
}
EOF
sudo chmod 644 "$PROFILED_FILE"
chmod 644 "$PROFILED_FILE"
# ===== 自动写入 bashrc关键=====
local BASHRC_FILE="/root/.bashrc"
@ -486,8 +486,8 @@ if command -v systemctl >/dev/null 2>&1; then
log ""
log "${C_BOLD}常用命令:${C_NC}"
log " $(cmd "sudo systemctl status ${Service_Name}.service")"
log " $(cmd "sudo systemctl restart ${Service_Name}.service")"
log " $(cmd "systemctl status ${Service_Name}.service")"
log " $(cmd "systemctl restart ${Service_Name}.service")"
fi
# =========================
@ -552,11 +552,11 @@ SHOW_FILE="${SECRET_FILE:-$CONF_DIR/config.yaml}"
if [[ -n "$SECRET_VAL" ]]; then
MASKED="${SECRET_VAL}"
log "🔐 Secret${C_YELLOW}${MASKED}${C_NC}"
# log " 查看完整 Secret$(cmd "sudo sed -nE 's/^[[:space:]]*secret:[[:space:]]*//p' \"$SHOW_FILE\" | head -n 1")"
# log " 查看完整 Secret$(cmd "sed -nE 's/^[[:space:]]*secret:[[:space:]]*//p' \"$SHOW_FILE\" | head -n 1")"
else
log "🔐 Secret${C_YELLOW}启动中暂未读到(稍后再试)${C_NC}"
log " 稍后查看:$(cmd "sudo sed -nE 's/^[[:space:]]*secret:[[:space:]]*//p' \"$CONF_DIR/config.yaml\" | head -n 1")"
log " 也可检查运行态:$(cmd "sudo sed -nE 's/^[[:space:]]*secret:[[:space:]]*//p' \"$TEMP_DIR/config.yaml\" | head -n 1")"
log " 稍后查看:$(cmd "sed -nE 's/^[[:space:]]*secret:[[:space:]]*//p' \"$CONF_DIR/config.yaml\" | head -n 1")"
log " 也可检查运行态:$(cmd "sed -nE 's/^[[:space:]]*secret:[[:space:]]*//p' \"$TEMP_DIR/config.yaml\" | head -n 1")"
fi
# =========================
@ -572,10 +572,10 @@ else
warn "订阅地址未配置(必须)"
log ""
log "配置订阅地址:"
log " $(cmd "sudo bash -c 'echo \"CLASH_URL=<订阅地址>\" > ${ENV_FILE}'")"
log " $(cmd "bash -c 'echo \"CLASH_URL=<订阅地址>\" > ${ENV_FILE}'")"
log ""
log "配置完成后重启服务:"
log " $(cmd "sudo systemctl restart ${Service_Name}.service")"
log " $(cmd "systemctl restart ${Service_Name}.service")"
fi
# =========================