#!/bin/sh # OpenWrt DRCom 登录脚本 - 卸载脚本 echo "==========================================" echo " DRCom Login - OpenWrt Uninstall" echo "==========================================" echo "" # 检查是否为 root 用户 if [ "$(id -u)" -ne 0 ]; then echo "[ERROR] Please run as root" exit 1 fi # 停止服务 echo "[STEP 1/4] Stopping service..." /etc/init.d/drcom-login stop 2>/dev/null # 禁用开机自启 echo "[STEP 2/4] Disabling auto-start..." /etc/init.d/drcom-login disable 2>/dev/null # 删除文件 echo "[STEP 3/4] Removing files..." rm -f /etc/init.d/drcom-login rm -f /usr/bin/drcom_login.py rm -f /usr/bin/drcom_login.py.bak rm -f /var/run/drcom-login.pid # 询问是否删除配置和日志 echo "[STEP 4/4] Cleanup..." echo "Remove configuration and log files? (y/n)" read -r choice if [ "$choice" = "y" ] || [ "$choice" = "Y" ]; then rm -rf /etc/drcom rm -f /var/log/drcom-login.log echo "[OK] All files removed." else echo "[INFO] Configuration and log files preserved in:" echo " /etc/drcom/" echo " /var/log/drcom-login.log" fi echo "" echo "[SUCCESS] DRCom Login has been uninstalled." exit 0