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,18 +2,27 @@
set -euo pipefail
##########################
# Color helpers
# 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'
[ ! -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"; }
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"; }
##########################
# Variables
@@ -37,27 +46,27 @@ enable_graphical_target() { sudo systemctl enable sddm; sudo systemctl set-defau
##########################
# Install Plasma
##########################
color_yellow; echo "Starting KDE Plasma installation..."; color_reset
say_yellow "Starting KDE Plasma installation..."
CURRENT_DE="$(detect_de)"
CURRENT_DM="$(detect_display_manager)"
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
enable_graphical_target
color_green; echo "KDE Plasma with SDDM installed successfully."; color_reset
say_green "KDE Plasma with SDDM installed successfully."
else
color_cyan; echo "Detected existing DE: $CURRENT_DE"; color_reset
say_cyan "Detected existing DE: $CURRENT_DE"
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 apt purge -y lightdm lightdm-gtk-greeter
install_packages sddm
enable_graphical_target
color_green; echo "LightDM replaced with SDDM."; color_reset
say_green "LightDM replaced with SDDM."
else
color_cyan; echo "Current DM: ${CURRENT_DM:-none}, leaving unchanged."; color_reset
say_cyan "Current DM: ${CURRENT_DM:-none}, leaving unchanged."
fi
fi