Files
isocreator/uninstall.sh

59 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
INSTALL_DIR="/opt/isocreator"
BIN_LINK="/usr/local/bin/isocreator"
CACHE_DIR="$HOME/.isocreator"
echo -e "${BLUE}🗑️ isocreator uninstaller${NC}"
echo ""
# Remove binary
if [ -f "${INSTALL_DIR}/isocreator" ]; then
echo -e "${BLUE}📦 Removing binary from ${INSTALL_DIR}...${NC}"
rm -f "${INSTALL_DIR}/isocreator"
# Remove directory if empty
if [ -d "$INSTALL_DIR" ] && [ -z "$(ls -A $INSTALL_DIR)" ]; then
rmdir "$INSTALL_DIR"
fi
echo -e "${GREEN}✅ Binary removed${NC}"
else
echo -e "${YELLOW}⚠️ Binary not found at ${INSTALL_DIR}${NC}"
fi
# Remove symlink
if [ -L "$BIN_LINK" ]; then
echo -e "${BLUE}🔗 Removing symlink ${BIN_LINK}...${NC}"
rm -f "$BIN_LINK"
echo -e "${GREEN}✅ Symlink removed${NC}"
else
echo -e "${YELLOW}⚠️ Symlink not found at ${BIN_LINK}${NC}"
fi
# Ask about cache
if [ -d "$CACHE_DIR" ]; then
echo ""
echo -e "${YELLOW}Cache directory found: ${CACHE_DIR}${NC}"
read -p "Do you want to remove cached ISOs? (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo -e "${BLUE}🗑️ Removing cache directory...${NC}"
rm -rf "$CACHE_DIR"
echo -e "${GREEN}✅ Cache removed${NC}"
else
echo -e "${BLUE} Cache directory kept${NC}"
fi
fi
echo ""
echo -e "${GREEN}✅ isocreator uninstalled successfully!${NC}"