updated debian scripts

This commit is contained in:
[yuri]
2025-11-10 12:50:37 +01:00
parent 60a4c9f906
commit 542cf935cd
8 changed files with 244 additions and 579 deletions

View File

@@ -25,71 +25,105 @@ color_gray() { printf '%b' "$GRAY"; }
color_reset() { printf '%b' "$RESET"; }
##########################
# Use exported variables from main detection script
# Optional logging
##########################
OS="${DETECTED_OS}"
DDE="${DETECTED_DE}"
LOGFILE="${LOGFILE:-/tmp/debian-xfce.log}"
exec > >(tee -a "$LOGFILE") 2>&1
##########################
# Paths and variables
##########################
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}"
DDE="${DETECTED_DE:-}"
DE="${SELECTED_DE:-none}"
TWM="${SELECTED_TWM:-none}"
INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}"
##########################
# 4. Desktop Environment installation
# Helper functions
##########################
install_packages() {
local packages=("$@")
sudo apt update
sudo apt install -y --no-install-recommends "${packages[@]}"
}
is_package_installed() {
dpkg -s "$1" &>/dev/null
}
detect_de() {
if command -v xfce4-session >/dev/null 2>&1; then
echo "xfce"
else
echo ""
fi
}
detect_display_manager() {
if [ -f /etc/X11/default-display-manager ]; then
basename "$(cat /etc/X11/default-display-manager)"
else
echo ""
fi
}
enable_graphical_target() {
sudo systemctl enable sddm
sudo systemctl set-default graphical.target
}
##########################
# Start installation
##########################
color_yellow
echo "Installing XFCE..."
echo "Starting XFCE installation..."
color_reset
# Detect if XFCE and SDDM are installed and install if needed
if [[ -z "$DDE" ]]; then
CURRENT_DE="$(detect_de)"
CURRENT_DM="$(detect_display_manager)"
if [[ -z "$CURRENT_DE" ]]; 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
install_packages sddm xfce4 xfce4-goodies
# Enable SDDM as the display manager
sudo systemctl enable sddm
# Enable graphical target
sudo systemctl set-default graphical.target
enable_graphical_target
color_green
echo
echo "XFCE with SDDM installed successfully."
echo "You can reboot now to start XFCE."
echo "XFCE with SDDM installed successfully. You can reboot now to start XFCE."
color_reset
else
color_cyan
echo
echo "You already have $DE installed."
echo "Detected existing Desktop Environment: $CURRENT_DE"
color_reset
# Check if LightDM is installed and active
if systemctl is-active --quiet lightdm; then
if [[ "$CURRENT_DM" == "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
install_packages sddm
enable_graphical_target
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."
echo "Current display manager: ${CURRENT_DM:-none}. Leaving unchanged."
color_reset
fi
fi
# Pause
read -n 1 -s -r -p "Press any key to continue"
echo