#!/bin/bash

set -e

INSTALL_DIR="/usr/local/bin"
BINARY_NAME="proxmox-cloud-image"

echo "=========================================="
echo "Proxmox Cloud Image Tool Uninstaller"
echo "=========================================="
echo ""

if [ "$EUID" -ne 0 ]; then 
    echo "Error: This script must be run as root (use sudo)"
    exit 1
fi

if [ -f "$INSTALL_DIR/$BINARY_NAME" ]; then
    echo "Removing $INSTALL_DIR/$BINARY_NAME..."
    rm -f "$INSTALL_DIR/$BINARY_NAME"
    echo "Uninstallation completed successfully!"
else
    echo "Binary not found at $INSTALL_DIR/$BINARY_NAME"
    echo "Nothing to uninstall."
fi

echo ""
