fix colors

This commit is contained in:
[yuri]
2025-11-10 15:54:48 +01:00
parent 58b72a37e9
commit ea55b1524b
9 changed files with 214 additions and 124 deletions

View File

@@ -2,27 +2,27 @@
set -euo pipefail set -euo pipefail
########################## ##########################
# Color helpers (no tput) # Color helpers (printf-safe, no tput)
########################## ##########################
RED='\033[0;31m' RED="\033[0;31m"
GREEN='\033[0;32m' GREEN="\033[0;32m"
YELLOW='\033[0;33m' YELLOW="\033[0;33m"
CYAN='\033[0;36m' CYAN="\033[0;36m"
GRAY='\033[0;37m' GRAY="\033[0;37m"
BOLD='\033[1m' BOLD="\033[1m"
RESET='\033[0m' RESET="\033[0m"
# Disable colors if output is not a terminal # Disable colors if output is not a terminal
if [ ! -t 1 ]; then if [ ! -t 1 ]; then
RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET='' RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi fi
color_red() { printf '%b' "$RED"; } say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
color_green() { printf '%b' "$GREEN"; } say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
color_yellow() { printf '%b' "$YELLOW"; } say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
color_cyan() { printf '%b' "$CYAN"; } say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
color_gray() { printf '%b' "$GRAY"; } say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
color_reset() { printf '%b' "$RESET"; } say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
########################## ##########################
# Use exported variables from main detection script # Use exported variables from main detection script
@@ -33,15 +33,14 @@ DE="${SELECTED_DE:-none}"
TWM="${SELECTED_TWM:-none}" TWM="${SELECTED_TWM:-none}"
INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}"
color_cyan
echo echo
echo "Starting Debian Chadwm setup..." say_cyan "Starting Debian Chadwm setup..."
color_reset say_cyan "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
echo echo
# End of script # End of script
color_green; echo "Chadwm setup completed."; color_reset say_green "Chadwm setup completed."
# Pause # Pause
read -n 1 -s -r -p "Press any key to continue" read -n 1 -s -r -p "Press any key to continue"

View File

@@ -1,14 +1,28 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
# Colors + logging same as others ##########################
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m' # Color helpers (printf-safe, no tput)
CYAN='\033[0;36m'; GRAY='\033[0;37m'; BOLD='\033[1m'; RESET='\033[0m' ##########################
[ ! -t 1 ] && RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET='' 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"
color_yellow() { printf '%b' "$YELLOW"; } # Disable colors if output is not a terminal
color_green() { printf '%b' "$GREEN"; } if [ ! -t 1 ]; then
color_reset() { printf '%b' "$RESET"; } RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi
say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}" OS="${DETECTED_OS:-debian}"
@@ -19,7 +33,7 @@ OS="${DETECTED_OS:-debian}"
install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; }
is_package_installed() { dpkg -s "$1" &>/dev/null; } is_package_installed() { dpkg -s "$1" &>/dev/null; }
color_yellow; echo "Starting full setup..."; color_reset say_yellow "Starting full setup..."
# Run minimal first # Run minimal first
bash "$SCRIPT_DIR/debian-minimal.sh" bash "$SCRIPT_DIR/debian-minimal.sh"
@@ -39,4 +53,4 @@ sudo sed -i 's/^managed=.*/managed=true/' /etc/NetworkManager/NetworkManager.con
sudo systemctl restart NetworkManager sudo systemctl restart NetworkManager
# End of script # End of script
color_green; echo "Full setup completed."; color_reset say_green "Full setup completed."

View File

@@ -1,18 +1,28 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
# Color helpers, logging, variables identical to plasma/xfce scripts ##########################
# 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"
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m' # Disable colors if output is not a terminal
CYAN='\033[0;36m'; GRAY='\033[0;37m'; BOLD='\033[1m'; RESET='\033[0m' if [ ! -t 1 ]; then
[ ! -t 1 ] && RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET='' RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi
color_red() { printf '%b' "$RED"; } say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
color_green() { printf '%b' "$GREEN"; } say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
color_yellow() { printf '%b' "$YELLOW"; } say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
color_cyan() { printf '%b' "$CYAN"; } say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
color_gray() { printf '%b' "$GRAY"; } say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
color_reset() { printf '%b' "$RESET"; } say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}" OS="${DETECTED_OS:-debian}"
@@ -30,26 +40,26 @@ detect_de() { command -v gnome-session >/dev/null 2>&1 && echo "gnome" || echo "
detect_display_manager() { [ -f /etc/X11/default-display-manager ] && basename "$(cat /etc/X11/default-display-manager)" || echo ""; } detect_display_manager() { [ -f /etc/X11/default-display-manager ] && basename "$(cat /etc/X11/default-display-manager)" || echo ""; }
enable_graphical_target() { sudo systemctl enable sddm; sudo systemctl set-default graphical.target; } enable_graphical_target() { sudo systemctl enable sddm; sudo systemctl set-default graphical.target; }
color_yellow; echo "Starting Gnome installation..."; color_reset say_yellow "Starting Gnome installation..."
CURRENT_DE="$(detect_de)" CURRENT_DE="$(detect_de)"
CURRENT_DM="$(detect_display_manager)" CURRENT_DM="$(detect_display_manager)"
if [[ -z "$CURRENT_DE" ]]; then if [[ -z "$CURRENT_DE" ]]; then
color_cyan; echo "No DE detected. Installing Gnome with SDDM..."; color_reset say_cyan "No DE detected. Installing Gnome with SDDM..."
install_packages sddm gnome-shell gnome-terminal nautilus gnome-control-center gnome-system-monitor gnome-tweaks network-manager-gnome gnome-keyring gnome-session install_packages sddm gnome-shell gnome-terminal nautilus gnome-control-center gnome-system-monitor gnome-tweaks network-manager-gnome gnome-keyring gnome-session
enable_graphical_target enable_graphical_target
color_green; echo "Gnome with SDDM installed successfully."; color_reset say_green "Gnome with SDDM installed successfully."
else else
color_cyan; echo "Detected existing DE: $CURRENT_DE"; color_reset say_cyan "Detected existing DE: $CURRENT_DE"
if [[ "$CURRENT_DM" == "lightdm" ]]; then if [[ "$CURRENT_DM" == "lightdm" ]]; then
color_yellow; echo "Replacing LightDM with SDDM..."; color_reset say_yellow "Replacing LightDM with SDDM..."
sudo systemctl disable lightdm sudo systemctl disable lightdm
sudo apt purge -y lightdm lightdm-gtk-greeter sudo apt purge -y lightdm lightdm-gtk-greeter
install_packages sddm install_packages sddm
enable_graphical_target enable_graphical_target
color_green; echo "LightDM replaced with SDDM."; color_reset say_green "LightDM replaced with SDDM."
else else
color_cyan; echo "Current DM: ${CURRENT_DM:-none}, leaving unchanged."; color_reset say_cyan "Current DM: ${CURRENT_DM:-none}, leaving unchanged."
fi fi
fi fi

View File

@@ -1,14 +1,28 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
# Colors + logging same pattern ##########################
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m' # Color helpers (printf-safe, no tput)
CYAN='\033[0;36m'; GRAY='\033[0;37m'; BOLD='\033[1m'; RESET='\033[0m' ##########################
[ ! -t 1 ] && RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET='' 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"
color_yellow() { printf '%b' "$YELLOW"; } # Disable colors if output is not a terminal
color_green() { printf '%b' "$GREEN"; } if [ ! -t 1 ]; then
color_reset() { printf '%b' "$RESET"; } RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi
say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}" OS="${DETECTED_OS:-debian}"
@@ -19,13 +33,13 @@ OS="${DETECTED_OS:-debian}"
install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; }
is_package_installed() { dpkg -s "$1" &>/dev/null; } is_package_installed() { dpkg -s "$1" &>/dev/null; }
color_yellow; echo "Starting hyprland setup..."; color_reset say_yellow "Starting hyprland setup..."
# Optionally add hyprland-specific packages here # Optionally add hyprland-specific packages here
#install_packages ???? #install_packages ????
# End of script # End of script
color_green; echo "hyprland setup completed."; color_reset say_green "hyprland setup completed."
# Pause # Pause
read -n 1 -s -r -p "Press any key to continue" read -n 1 -s -r -p "Press any key to continue"

View File

@@ -1,17 +1,28 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
# Colors + logging same pattern ##########################
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m' # Color helpers (printf-safe, no tput)
CYAN='\033[0;36m'; GRAY='\033[0;37m'; BOLD='\033[1m'; RESET='\033[0m' ##########################
[ ! -t 1 ] && RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET='' 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"
color_red() { printf '%b' "$RED"; } # Disable colors if output is not a terminal
color_green() { printf '%b' "$GREEN"; } if [ ! -t 1 ]; then
color_yellow() { printf '%b' "$YELLOW"; } RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
color_cyan() { printf '%b' "$CYAN"; } fi
color_gray() { printf '%b' "$GRAY"; }
color_reset() { printf '%b' "$RESET"; } say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}" OS="${DETECTED_OS:-debian}"
@@ -23,7 +34,7 @@ DE="${SELECTED_DE:-none}"
install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; }
is_package_installed() { dpkg -s "$1" &>/dev/null; } is_package_installed() { dpkg -s "$1" &>/dev/null; }
color_yellow; echo "Starting minimal setup..."; color_reset say_yellow "Starting minimal setup..."
# Create user directories # Create user directories
mkdir -p "$HOME"/{.bin,.fonts,.icons,.themes,DATA} "$HOME/.local/share/"{icons,themes,applications} "$HOME/.config/"{autostart,gtk-{3.0,4.0},variety,fish,neofetch} mkdir -p "$HOME"/{.bin,.fonts,.icons,.themes,DATA} "$HOME/.local/share/"{icons,themes,applications} "$HOME/.config/"{autostart,gtk-{3.0,4.0},variety,fish,neofetch}
@@ -43,4 +54,4 @@ sudo systemctl enable chrony
sudo systemctl enable fstrim.timer sudo systemctl enable fstrim.timer
# End of script # End of script
color_green; echo "Minimal setup completed."; color_reset say_green "Minimal setup completed."

View File

@@ -2,18 +2,27 @@
set -euo pipefail set -euo pipefail
########################## ##########################
# Color helpers # Color helpers (printf-safe, no tput)
########################## ##########################
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m' RED="\033[0;31m"
CYAN='\033[0;36m'; GRAY='\033[0;37m'; BOLD='\033[1m'; RESET='\033[0m' GREEN="\033[0;32m"
[ ! -t 1 ] && RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET='' YELLOW="\033[0;33m"
CYAN="\033[0;36m"
GRAY="\033[0;37m"
BOLD="\033[1m"
RESET="\033[0m"
color_red() { printf '%b' "$RED"; } # Disable colors if output is not a terminal
color_green() { printf '%b' "$GREEN"; } if [ ! -t 1 ]; then
color_yellow() { printf '%b' "$YELLOW"; } RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
color_cyan() { printf '%b' "$CYAN"; } fi
color_gray() { printf '%b' "$GRAY"; }
color_reset() { printf '%b' "$RESET"; } say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
########################## ##########################
# Variables # Variables
@@ -37,27 +46,27 @@ enable_graphical_target() { sudo systemctl enable sddm; sudo systemctl set-defau
########################## ##########################
# Install Plasma # Install Plasma
########################## ##########################
color_yellow; echo "Starting KDE Plasma installation..."; color_reset say_yellow "Starting KDE Plasma installation..."
CURRENT_DE="$(detect_de)" CURRENT_DE="$(detect_de)"
CURRENT_DM="$(detect_display_manager)" CURRENT_DM="$(detect_display_manager)"
if [[ -z "$CURRENT_DE" ]]; then if [[ -z "$CURRENT_DE" ]]; then
color_cyan; echo "No DE detected. Installing KDE Plasma with SDDM..."; color_reset say_cyan "No DE detected. Installing KDE Plasma with SDDM..."
install_packages sddm plasma-desktop dolphin konsole kate plasma-nm plasma-workspace kde-config-gtk-style kde-config-sddm plasma-discover kscreen install_packages sddm plasma-desktop dolphin konsole kate plasma-nm plasma-workspace kde-config-gtk-style kde-config-sddm plasma-discover kscreen
enable_graphical_target enable_graphical_target
color_green; echo "KDE Plasma with SDDM installed successfully."; color_reset say_green "KDE Plasma with SDDM installed successfully."
else else
color_cyan; echo "Detected existing DE: $CURRENT_DE"; color_reset say_cyan "Detected existing DE: $CURRENT_DE"
if [[ "$CURRENT_DM" == "lightdm" ]]; then if [[ "$CURRENT_DM" == "lightdm" ]]; then
color_yellow; echo "Replacing LightDM with SDDM..."; color_reset colosay_yellow "Replacing LightDM with SDDM..."
sudo systemctl disable lightdm sudo systemctl disable lightdm
sudo apt purge -y lightdm lightdm-gtk-greeter sudo apt purge -y lightdm lightdm-gtk-greeter
install_packages sddm install_packages sddm
enable_graphical_target enable_graphical_target
color_green; echo "LightDM replaced with SDDM."; color_reset say_green "LightDM replaced with SDDM."
else else
color_cyan; echo "Current DM: ${CURRENT_DM:-none}, leaving unchanged."; color_reset say_cyan "Current DM: ${CURRENT_DM:-none}, leaving unchanged."
fi fi
fi fi

View File

@@ -1,14 +1,28 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
# Colors + logging same pattern ##########################
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m' # Color helpers (printf-safe, no tput)
CYAN='\033[0;36m'; GRAY='\033[0;37m'; BOLD='\033[1m'; RESET='\033[0m' ##########################
[ ! -t 1 ] && RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET='' 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"
color_yellow() { printf '%b' "$YELLOW"; } # Disable colors if output is not a terminal
color_green() { printf '%b' "$GREEN"; } if [ ! -t 1 ]; then
color_reset() { printf '%b' "$RESET"; } RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi
say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}" OS="${DETECTED_OS:-debian}"
@@ -19,13 +33,13 @@ OS="${DETECTED_OS:-debian}"
install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; }
is_package_installed() { dpkg -s "$1" &>/dev/null; } is_package_installed() { dpkg -s "$1" &>/dev/null; }
color_yellow; echo "Starting Server setup..."; color_reset say_yellow "Starting Server setup..."
# Optionally add Server-specific packages here # Optionally add Server-specific packages here
install_packages linux-headers-$(uname -r) install_packages linux-headers-$(uname -r)
# End of script # End of script
color_green; echo "Server setup completed."; color_reset say_green "Server setup completed."
# Pause # Pause
read -n 1 -s -r -p "Press any key to continue" read -n 1 -s -r -p "Press any key to continue"

View File

@@ -1,14 +1,28 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
# Colors + logging same pattern ##########################
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m' # Color helpers (printf-safe, no tput)
CYAN='\033[0;36m'; GRAY='\033[0;37m'; BOLD='\033[1m'; RESET='\033[0m' ##########################
[ ! -t 1 ] && RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET='' 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"
color_yellow() { printf '%b' "$YELLOW"; } # Disable colors if output is not a terminal
color_green() { printf '%b' "$GREEN"; } if [ ! -t 1 ]; then
color_reset() { printf '%b' "$RESET"; } RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi
say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}" OS="${DETECTED_OS:-debian}"
@@ -19,7 +33,7 @@ OS="${DETECTED_OS:-debian}"
install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; }
is_package_installed() { dpkg -s "$1" &>/dev/null; } is_package_installed() { dpkg -s "$1" &>/dev/null; }
color_yellow; echo "Starting workstation setup..."; color_reset say_yellow "Starting workstation setup..."
# Run full setup first # Run full setup first
bash "$SCRIPT_DIR/debian-full.sh" bash "$SCRIPT_DIR/debian-full.sh"
@@ -28,7 +42,7 @@ bash "$SCRIPT_DIR/debian-full.sh"
install_packages git vlc libreoffice install_packages git vlc libreoffice
# End of script # End of script
color_green; echo "Workstation setup completed."; color_reset say_green "Workstation setup completed."
# Pause # Pause
read -n 1 -s -r -p "Press any key to continue" read -n 1 -s -r -p "Press any key to continue"

View File

@@ -2,22 +2,27 @@
set -euo pipefail set -euo pipefail
########################## ##########################
# Color helpers (no tput) # Color helpers (printf-safe, no tput)
########################## ##########################
RED='\033[0;31m' RED="\033[0;31m"
GREEN='\033[0;32m' GREEN="\033[0;32m"
YELLOW='\033[0;33m' YELLOW="\033[0;33m"
CYAN='\033[0;36m' CYAN="\033[0;36m"
GRAY='\033[0;37m' GRAY="\033[0;37m"
BOLD='\033[1m' BOLD="\033[1m"
RESET='\033[0m' RESET="\033[0m"
color_red() { printf '%b' "$RED"; } # Disable colors if output is not a terminal
color_green() { printf '%b' "$GREEN"; } if [ ! -t 1 ]; then
color_yellow() { printf '%b' "$YELLOW"; } RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
color_cyan() { printf '%b' "$CYAN"; } fi
color_gray() { printf '%b' "$GRAY"; }
color_reset() { printf '%b' "$RESET"; } say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
########################## ##########################
# Paths and variables # Paths and variables
@@ -65,23 +70,23 @@ enable_graphical_target() {
########################## ##########################
# Start installation # Start installation
########################## ##########################
echo -e "${YELLOW}Starting XFCE installation...${RESET}" say_yellow -e "Starting XFCE installation..."
CURRENT_DE="$(detect_de)" CURRENT_DE="$(detect_de)"
CURRENT_DM="$(detect_display_manager)" CURRENT_DM="$(detect_display_manager)"
if [[ -z "$CURRENT_DE" ]]; then if [[ -z "$CURRENT_DE" ]]; then
echo -e "${CYAN}No Desktop Environment detected. Installing XFCE (light setup with SDDM)...${RESET}" say_cyan -e "No Desktop Environment detected. Installing XFCE (light setup with SDDM)..."
install_packages sddm xfce4 xfce4-goodies install_packages sddm xfce4 xfce4-goodies
enable_graphical_target enable_graphical_target
echo -e "${GREEN}XFCE with SDDM installed successfully. You can reboot now to start XFCE.${RESET}" say_green -e "XFCE with SDDM installed successfully. You can reboot now to start XFCE."
else else
echo -e "${CYAN}Detected existing Desktop Environment: $CURRENT_DE${RESET}" say_cyan -e "Detected existing Desktop Environment: $CURRENT_DE"
if [[ "$CURRENT_DM" == "lightdm" ]]; then if [[ "$CURRENT_DM" == "lightdm" ]]; then
echo -e "${YELLOW}LightDM is currently active. Replacing with SDDM...${RESET}" say_yellow -e "LightDM is currently active. Replacing with SDDM..."
sudo systemctl disable lightdm sudo systemctl disable lightdm
sudo apt purge -y lightdm lightdm-gtk-greeter sudo apt purge -y lightdm lightdm-gtk-greeter
@@ -89,9 +94,9 @@ else
install_packages sddm install_packages sddm
enable_graphical_target enable_graphical_target
echo -e "${GREEN}LightDM removed and replaced with SDDM.${RESET}" say_green -e "LightDM removed and replaced with SDDM."
else else
echo -e "${CYAN}Current display manager: ${CURRENT_DM:-none}. Leaving unchanged.${RESET}" say_cyan -e "Current display manager: ${CURRENT_DM:-none}. Leaving unchanged."
fi fi
fi fi
@@ -101,4 +106,4 @@ echo -e "[Autologin]\nSession=xfce.desktop" | sudo tee /etc/sddm.conf.d/10-xfce.
echo -e "[General]\nSession=xfce.desktop" | sudo tee /etc/sddm.conf.d/10-xfce-session.conf >/dev/null echo -e "[General]\nSession=xfce.desktop" | sudo tee /etc/sddm.conf.d/10-xfce-session.conf >/dev/null
# End of script # End of script
echo -e "${GREEN}XFCE / SDDM setup completed.${RESET}" say_green -e "XFCE / SDDM setup completed."