106 lines
3.2 KiB
Bash
Executable File
106 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Clean script for Cthulhu screen reader Meson build
|
|
# This script removes build artifacts and optionally the local installation
|
|
#
|
|
|
|
set -e # Exit on error
|
|
|
|
# Colors for output (only if stdout is a terminal)
|
|
if [[ -t 1 ]]; then
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
else
|
|
RED=''
|
|
GREEN=''
|
|
YELLOW=''
|
|
BLUE=''
|
|
NC=''
|
|
fi
|
|
|
|
echo -e "${BLUE}Cthulhu Meson Clean Script${NC}"
|
|
echo "Cleaning build artifacts and local installation"
|
|
echo "=============================================="
|
|
|
|
# Clean build directory
|
|
if [[ -d "_build" ]]; then
|
|
echo -e "${YELLOW}Removing build directory...${NC}"
|
|
rm -rf _build
|
|
echo -e "${GREEN}Build directory cleaned${NC}"
|
|
else
|
|
echo "No build directory found"
|
|
fi
|
|
|
|
# Ask about local installation cleanup
|
|
echo
|
|
read -p "Remove local installation from ~/.local? (y/N): " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
echo -e "${YELLOW}Removing local installation...${NC}"
|
|
|
|
# Remove binary
|
|
if [[ -f "$HOME/.local/bin/cthulhu" ]]; then
|
|
rm -f "$HOME/.local/bin/cthulhu"
|
|
echo " Removed: ~/.local/bin/cthulhu"
|
|
fi
|
|
|
|
# Remove Python modules
|
|
PYTHON_SITE="$HOME/.local/lib/python$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')/site-packages"
|
|
if [[ -d "$PYTHON_SITE/cthulhu" ]]; then
|
|
rm -rf "$PYTHON_SITE/cthulhu"
|
|
echo " Removed: $PYTHON_SITE/cthulhu/"
|
|
fi
|
|
|
|
# Remove data files
|
|
|
|
# Remove desktop files
|
|
if [[ -f "$HOME/.local/share/applications/cthulhu-autostart.desktop" ]]; then
|
|
rm -f "$HOME/.local/share/applications/cthulhu-autostart.desktop"
|
|
echo " Removed: ~/.local/share/applications/cthulhu-autostart.desktop"
|
|
fi
|
|
|
|
# Remove icons
|
|
for size in 16x16 22x22 24x24 32x32 48x48 256x256 scalable symbolic; do
|
|
icon_path="$HOME/.local/share/icons/hicolor/$size/apps"
|
|
if [[ -f "$icon_path/cthulhu.png" ]]; then
|
|
rm -f "$icon_path/cthulhu.png"
|
|
echo " Removed: $icon_path/cthulhu.png"
|
|
fi
|
|
if [[ -f "$icon_path/cthulhu.svg" ]]; then
|
|
rm -f "$icon_path/cthulhu.svg"
|
|
echo " Removed: $icon_path/cthulhu.svg"
|
|
fi
|
|
if [[ -f "$icon_path/cthulhu-symbolic.svg" ]]; then
|
|
rm -f "$icon_path/cthulhu-symbolic.svg"
|
|
echo " Removed: $icon_path/cthulhu-symbolic.svg"
|
|
fi
|
|
done
|
|
|
|
# Remove man page
|
|
if [[ -f "$HOME/.local/share/man/man1/cthulhu.1" ]]; then
|
|
rm -f "$HOME/.local/share/man/man1/cthulhu.1"
|
|
echo " Removed: ~/.local/share/man/man1/cthulhu.1"
|
|
fi
|
|
|
|
# Update caches
|
|
if command -v update-desktop-database &> /dev/null; then
|
|
echo -e "${YELLOW}Updating desktop database...${NC}"
|
|
update-desktop-database "$HOME/.local/share/applications" 2>/dev/null || true
|
|
fi
|
|
|
|
if command -v gtk-update-icon-cache &> /dev/null; then
|
|
echo -e "${YELLOW}Updating icon cache...${NC}"
|
|
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" 2>/dev/null || true
|
|
fi
|
|
|
|
echo -e "${GREEN}Local installation cleaned${NC}"
|
|
else
|
|
echo "Local installation preserved"
|
|
fi
|
|
|
|
echo
|
|
echo -e "${GREEN}Cleanup completed!${NC}"
|