Files
starburst/v2/debian-xfce.sh
2025-11-10 11:23:02 +01:00

96 lines
2.3 KiB
Bash
Executable File

#!/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'
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
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"; }
##########################
# 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}"
##########################
# 4. Desktop Environment installation
##########################
color_yellow
echo "Installing XFCE..."
color_reset
# Detect if XFCE and SDDM are installed and install if needed
if [[ -z "$DDE" ]]; then
color_cyan
echo
echo "No Desktop Environment detected. Installing XFCE (light setup with SDDM)..."
color_reset
sudo apt update
sudo apt install -y --no-install-recommends sddm xfce4 xfce4-goodies
# Enable SDDM as the display manager
sudo systemctl enable sddm
# Enable graphical target
sudo systemctl set-default graphical.target
color_green
echo
echo "XFCE with SDDM installed successfully."
echo "You can reboot now to start XFCE."
color_reset
else
color_cyan
echo
echo "You already have $DE installed."
color_reset
# Check if LightDM is installed and active
if systemctl is-active --quiet lightdm; then
color_yellow
echo
echo "LightDM is currently active. Replacing with SDDM..."
color_reset
# Disable and remove LightDM
sudo systemctl disable lightdm
sudo apt purge -y lightdm lightdm-gtk-greeter
# Install and enable SDDM
sudo apt install -y sddm
sudo systemctl enable sddm
color_green
echo
echo "LightDM removed and replaced with SDDM."
color_reset
else
color_cyan
echo
echo "No LightDM detected, leaving current display manager unchanged."
color_reset
fi
fi