#!/bin/bash set -euo pipefail ########################## # Color helpers (printf-safe, no tput) ########################## RED="\033[0;31m" GREEN="\033[0;32m" YELLOW="\033[0;33m" CYAN="\033[0;36m" GRAY="\033[0;37m" BOLD="\033[1m" RESET="\033[0m" # Disable colors if output is not a terminal if [ ! -t 1 ]; then RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET="" fi say_red() { printf "\n"; printf "%b%s%b\n" "$RED" "$*" "$RESET"; } say_green() { printf "\n"; printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; } say_yellow() { printf "\n"; printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; } say_cyan() { printf "\n"; printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; } say_gray() { printf "\n"; printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; } say_bold() { printf "\n"; printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; } ########################## # Use exported variables from main detection script ########################## OS="${DETECTED_OS:-debian}" DDE="${DETECTED_DE:-}" DE="${SELECTED_DE:-none}" TWM="${SELECTED_TWM:-none}" INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ########################## # Helper functions ########################## install_packages() { sudo pacman -Sy; sudo pacman -S --noconfirm --needed "$@"; } is_package_installed() { pacman -Qi "$@" &>/dev/null; } remove_packages() { local packages_to_remove=() # 1. Identify which packages are actually installed for pkg in "$@"; do if is_package_installed "$pkg"; then packages_to_remove+=("$pkg") else say_gray "Package '$pkg' not found. Skipping removal." fi done # 2. Only run pacman if there are packages to remove if [ ${#packages_to_remove[@]} -gt 0 ]; then say_cyan "Removing packages: ${packages_to_remove[*]}" sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true else say_gray "No packages to remove from the list." fi } say_yellow "Starting Workstation setup..." # Run full first bash "$SCRIPT_DIR/arch-full.sh" # Add extra packages install_packages git libreoffice-fresh # gitahead-git # editors install_packages vscodium sublime-text-4 #internet install_packages brave-bin insync # google-chrome discord firefox #theming # variety #media install_packages flameshot-git mpv-full # vlc gimp inkscape spotify lollypop #shells install_packages zsh zsh-completions zsh-syntax-highlighting oh-my-zsh-git # fish #system-tools install_packages base-devel #tools install_packages wttr system-config-printer ripgrep meld btop htop hwinfo lshw # End of script say_green "Workstation setup completed."