#!/bin/bash set -euo pipefail ########################## # Color helpers (no tput) ########################## RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[0;33m' CYAN='\033[0;36m' BOLD='\033[1m' RESET='\033[0m' # Disable colors if output is not a terminal if [ ! -t 1 ]; then RED='' GREEN='' YELLOW='' CYAN='' BOLD='' RESET='' fi color_red() { printf '%b' "$RED"; } color_green() { printf '%b' "$GREEN"; } color_yellow() { printf '%b' "$YELLOW"; } color_cyan() { printf '%b' "$CYAN"; } color_reset() { printf '%b' "$RESET"; } ########################## # Use exported variables from main detection script ########################## OS="${DETECTED_OS}" DDE="${DETECTED_DE}" DE="${SELECTED_DE:-none}" TWM="${SELECTED_TWM:-none}" INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" color_cyan echo echo "Starting Arch Linux setup..." color_reset echo echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" ########################## # 0. Ensure base is ready for installation ########################## installed_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" pkg_dir="packages" if [[ ! -d "$pkg_dir" ]]; then echo "Directory not found: $pkg_dir" exit 1 fi if ! command -v curl >/dev/null 2>&1; then color_yellow echo echo "curl is not installed. Installing..." color_reset sudo pacman -Sy --noconfirm curl fi # Install all local packages using pacman find "$pkg_dir" -maxdepth 1 -name '*.pkg.tar.zst' -print0 | sudo xargs -0 pacman -U --noconfirm ########################## # 1. Add repositories if missing ########################## color_yellow echo echo "Checking pacman.conf and sources..." color_reset sudo cp /etc/pacman.conf /etc/pacman.conf.bak.$(date +%s) sudo cp -v "$installed_dir/config-files/pacman.conf" /etc/pacman.conf # Update the system color_green echo echo "################################################################################" echo "Updating the system - sudo pacman -Syyu" echo "################################################################################" color_reset echo sudo pacman -Syyu --noconfirm ########################## # Fix missing console font ########################## color_yellow echo echo "################################################################" echo "Fix missing console font" echo "################################################################" color_reset if grep -q FONT= /etc/vconsole.conf; then color_green echo echo "Font is already set in /etc/vconsole.conf" color_reset else color_green echo echo "Setting console font in /etc/vconsole.conf" color_reset echo 'FONT=gr737c-8x14' | sudo tee -a /etc/vconsole.conf fi ########################## # Detected OS / DE / TWM info ########################## color_yellow echo echo "################################################################################" echo "Detected OS / Desktop Environment / Tiling Window Manager" echo "################################################################################" color_reset echo echo "Installing OS-specific packages..." echo "Selected DE: $DE" echo "Selected TWM: $TWM" echo "Installation Level: $INSTALL_LEVEL" # Desktop Environment installation if [[ "$DE" == "xfce" ]]; then color_green echo echo "################################################################################" echo "Installing XFCE4" echo "################################################################################" color_reset echo "Installing XFCE packages..." fi if [[ "$DE" == "plasma" ]]; then color_green echo echo "################################################################################" echo "Installing KDE Plasma 6" echo "################################################################################" color_reset echo "Installing Plasma packages..." fi if [[ "$DE" == "gnome" ]]; then color_green echo echo "################################################################################" echo "Installing Gnome 48" echo "################################################################################" color_reset echo "Installing Gnome packages..." fi if [[ "$DE" == "none" ]]; then color_green echo echo "################################################################################" echo "Installing no Desktop Environment" echo "################################################################################" color_reset echo "Installing no Desktop Environment packages..." fi # Tiling Window Manager installation if [[ "$TWM" == "chadwm" ]]; then color_green echo echo "################################################################################" echo "Installing Chadwm" echo "################################################################################" color_reset echo "Installing CHADWM..." fi if [[ "$TWM" == "hyprland" ]]; then color_green echo echo "################################################################################" echo "Installing Hyprland" echo "################################################################################" color_reset echo "Installing Hyprland..." fi if [[ "$TWM" == "none" ]]; then color_green echo echo "################################################################################" echo "Installing no Tiling Window Manager" echo "################################################################################" color_reset echo "Installing no Tiling Window Manager packages..." fi