#!/bin/bash # SZCI Uninstaller Script # Removes SZCI from the system (installed via install.sh) # # Usage: # sudo bash uninstall.sh set -e # Check if running as root if [ "$EUID" -ne 0 ]; then echo "Please run as root (sudo bash uninstall.sh)" exit 1 fi echo "================================================" echo " SZCI Uninstaller" echo " Serve Zone CI/CD Tool Removal" echo "================================================" echo "" # Default installation directory INSTALL_DIR="/opt/szci" # Step 1: Remove global symlinks echo "Checking for global symlinks..." if [ -L "/usr/local/bin/szci" ]; then echo "Removing symlink: /usr/local/bin/szci" rm -f /usr/local/bin/szci fi if [ -L "/usr/bin/szci" ]; then echo "Removing symlink: /usr/bin/szci" rm -f /usr/bin/szci fi # Step 2: Remove installation directory if [ -d "$INSTALL_DIR" ]; then echo "Removing installation directory: $INSTALL_DIR" rm -rf "$INSTALL_DIR" else echo "Installation directory not found: $INSTALL_DIR" fi echo "" echo "================================================" echo " SZCI Uninstallation Complete!" echo "================================================" echo "" # Check for npm global installation NODE_PATH=$(which node 2>/dev/null || true) if [ -n "$NODE_PATH" ]; then NPM_PATH=$(dirname "$NODE_PATH")/npm if [ -x "$NPM_PATH" ]; then echo "If you installed SZCI via npm, you may want to uninstall it with:" echo " npm uninstall -g @ship.zone/szci" echo "" fi fi echo "SZCI has been removed from your system." echo ""