first commit
This commit is contained in:
35
poweroff_linux/uninstall.sh
Normal file
35
poweroff_linux/uninstall.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
info() { echo -e "${GREEN}[INFO]${NC} $1"; }
|
||||
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||
|
||||
INSTALL_DIR="/opt/ttyshutdown"
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo -e "${RED}[ERROR]${NC} 请使用 root 权限运行: sudo bash uninstall.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}即将卸载串口关机控制器${NC}"
|
||||
read -rp "确认卸载? [y/N]: " confirm
|
||||
if [[ ! "$confirm" =~ ^[Yy] ]]; then
|
||||
info "已取消"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
systemctl stop ttyshutdown.service 2>/dev/null || true
|
||||
systemctl disable ttyshutdown.service 2>/dev/null || true
|
||||
rm -f /etc/systemd/system/ttyshutdown.service
|
||||
systemctl daemon-reload
|
||||
|
||||
rm -f /usr/lib/systemd/system-shutdown/send_signal.sh
|
||||
|
||||
rm -rf "$INSTALL_DIR"
|
||||
|
||||
info "卸载完成"
|
||||
Reference in New Issue
Block a user