uninstall.sh 715 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. set -e -o pipefail
  3. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
  4. source "$SCRIPT_DIR/common.sh"
  5. echo "Uninstalling sing-box..."
  6. if systemctl is-active --quiet sing-box 2>/dev/null; then
  7. echo "Stopping sing-box service..."
  8. sudo systemctl stop sing-box
  9. fi
  10. if systemctl is-enabled --quiet sing-box 2>/dev/null; then
  11. echo "Disabling sing-box service..."
  12. sudo systemctl disable sing-box
  13. fi
  14. echo "Removing files..."
  15. sudo rm -rf "$INSTALL_DATA_PATH"
  16. sudo rm -rf "$INSTALL_BIN_PATH/$BINARY_NAME"
  17. sudo rm -rf "$INSTALL_CONFIG_PATH"
  18. sudo rm -rf "$SYSTEMD_SERVICE_PATH/sing-box.service"
  19. echo "Reloading systemd..."
  20. sudo systemctl daemon-reload
  21. echo ""
  22. echo "Uninstallation complete!"