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,22 +2,27 @@
set -euo pipefail
##########################
# Color helpers (no tput)
# 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"
CYAN="\033[0;36m"
GRAY="\033[0;37m"
BOLD="\033[1m"
RESET="\033[0m"
color_red() { printf '%b' "$RED"; }
color_green() { printf '%b' "$GREEN"; }
color_yellow() { printf '%b' "$YELLOW"; }
color_cyan() { printf '%b' "$CYAN"; }
color_gray() { printf '%b' "$GRAY"; }
color_reset() { printf '%b' "$RESET"; }
# Disable colors if output is not a terminal
if [ ! -t 1 ]; then
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"; }
##########################
# Paths and variables
@@ -65,23 +70,23 @@ enable_graphical_target() {
##########################
# Start installation
##########################
echo -e "${YELLOW}Starting XFCE installation...${RESET}"
say_yellow -e "Starting XFCE installation..."
CURRENT_DE="$(detect_de)"
CURRENT_DM="$(detect_display_manager)"
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
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
echo -e "${CYAN}Detected existing Desktop Environment: $CURRENT_DE${RESET}"
say_cyan -e "Detected existing Desktop Environment: $CURRENT_DE"
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 apt purge -y lightdm lightdm-gtk-greeter
@@ -89,9 +94,9 @@ else
install_packages sddm
enable_graphical_target
echo -e "${GREEN}LightDM removed and replaced with SDDM.${RESET}"
say_green -e "LightDM removed and replaced with SDDM."
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
@@ -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
# End of script
echo -e "${GREEN}XFCE / SDDM setup completed.${RESET}"
say_green -e "XFCE / SDDM setup completed."