fix arch xfce + add arch plasma
This commit is contained in:
114
v2/arch-plasma.sh
Executable file
114
v2/arch-plasma.sh
Executable file
@@ -0,0 +1,114 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
# Disable colors if output is not a terminal
|
||||||
|
if [ ! -t 1 ]; then
|
||||||
|
RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
say_red() { printf "\n"; printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
|
||||||
|
say_green() { printf "\n"; printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
|
||||||
|
say_yellow() { printf "\n"; printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
|
||||||
|
say_cyan() { printf "\n"; printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
|
||||||
|
say_gray() { printf "\n"; printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
|
||||||
|
say_bold() { printf "\n"; printf "%b%s%b\n" "$BOLD" "$*" "$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}"
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# Helper functions
|
||||||
|
##########################
|
||||||
|
install_packages() { sudo pacman -S --noconfirm --needed "$@"; }
|
||||||
|
remove_packages() { sudo pacman -Rs --noconfirm "$@"; }
|
||||||
|
is_package_installed() { pacman -Qi "$@" &>/dev/null; }
|
||||||
|
|
||||||
|
detect_de() {
|
||||||
|
if command -v plasmashell >/dev/null 2>&1; then
|
||||||
|
echo "kde"
|
||||||
|
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
|
||||||
|
##########################
|
||||||
|
say_yellow -e "Starting KDE Plasma installation..."
|
||||||
|
|
||||||
|
CURRENT_DE="$(detect_de)"
|
||||||
|
CURRENT_DM="$(detect_display_manager)"
|
||||||
|
|
||||||
|
if [[ -z "$CURRENT_DE" || "$CURRENT_DE" != "kde" ]]; then
|
||||||
|
say_cyan -e "KDE Plasma not detected. Installing KDE Plasma (light setup with SDDM)..."
|
||||||
|
|
||||||
|
install_packages sddm plasma kde-applications
|
||||||
|
enable_graphical_target
|
||||||
|
|
||||||
|
say_green -e "KDE Plasma with SDDM installed successfully. You can reboot now to start XFCE."
|
||||||
|
else
|
||||||
|
say_cyan -e "Detected existing Desktop Environment: $CURRENT_DE. Checking Display Manager..."
|
||||||
|
|
||||||
|
# Check and replace other Display Managers if they conflict with the preferred SDDM setup
|
||||||
|
if [[ "$CURRENT_DM" != "sddm" ]]; then
|
||||||
|
say_yellow -e "Display manager **$CURRENT_DM** is currently active. Replacing with **SDDM**, the default for KDE Plasma..."
|
||||||
|
|
||||||
|
# Attempt to disable the old DM if detected
|
||||||
|
if [ ! -z "$CURRENT_DM" ]; then
|
||||||
|
sudo systemctl disable "$CURRENT_DM" || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove common alternative DMs if they exist to prevent conflicts
|
||||||
|
if is_package_installed lightdm; then
|
||||||
|
say_gray -e "Removing lightdm..."
|
||||||
|
remove_packages lightdm lightdm-gtk-greeter || true
|
||||||
|
fi
|
||||||
|
if is_package_installed gdm; then
|
||||||
|
say_gray -e "Removing gdm..."
|
||||||
|
remove_packages gdm || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure SDDM is installed and enabled
|
||||||
|
install_packages sddm
|
||||||
|
enable_graphical_target
|
||||||
|
|
||||||
|
say_green -e "Old display manager removed and replaced with SDDM."
|
||||||
|
else
|
||||||
|
say_cyan -e "Current display manager is already **SDDM**. Leaving unchanged."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# End of script
|
||||||
|
say_green -e "KDE Plasma / SDDM setup completed."
|
||||||
|
|
||||||
@@ -70,28 +70,42 @@ 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" || "$CURRENT_DE" != "xfce" ]]; then
|
||||||
say_cyan -e "No Desktop Environment detected. Installing XFCE (light setup with SDDM)..."
|
say_cyan -e "XFCE4 not 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
|
||||||
|
|
||||||
say_green -e "XFCE with SDDM installed successfully. You can reboot now to start XFCE."
|
say_green -e "XFCE with SDDM installed successfully. You can reboot now to start XFCE."
|
||||||
else
|
else
|
||||||
say_cyan -e "Detected existing Desktop Environment: $CURRENT_DE"
|
say_cyan -e "Detected existing Desktop Environment: $CURRENT_DE. Checking Display Manager..."
|
||||||
|
|
||||||
if [[ "$CURRENT_DM" == "lightdm" ]]; then
|
# Check and replace other Display Managers if they conflict with the preferred SDDM setup
|
||||||
say_yellow -e "LightDM is currently active. Replacing with SDDM..."
|
if [[ "$CURRENT_DM" != "sddm" ]]; then
|
||||||
|
say_yellow -e "Display manager **$CURRENT_DM** is currently active. Replacing with **SDDM**, the default for KDE Plasma..."
|
||||||
|
|
||||||
sudo systemctl disable lightdm
|
# Attempt to disable the old DM if detected
|
||||||
sudo apt purge -y lightdm lightdm-gtk-greeter
|
if [ ! -z "$CURRENT_DM" ]; then
|
||||||
|
sudo systemctl disable "$CURRENT_DM" || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove common alternative DMs if they exist to prevent conflicts
|
||||||
|
if is_package_installed lightdm; then
|
||||||
|
say_gray -e "Removing lightdm..."
|
||||||
|
remove_packages lightdm lightdm-gtk-greeter || true
|
||||||
|
fi
|
||||||
|
if is_package_installed gdm; then
|
||||||
|
say_gray -e "Removing gdm..."
|
||||||
|
remove_packages gdm || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure SDDM is installed and enabled
|
||||||
install_packages sddm
|
install_packages sddm
|
||||||
enable_graphical_target
|
enable_graphical_target
|
||||||
|
|
||||||
say_green -e "LightDM removed and replaced with SDDM."
|
say_green -e "Old display manager removed and replaced with SDDM."
|
||||||
else
|
else
|
||||||
say_cyan -e "Current display manager: ${CURRENT_DM:-none}. Leaving unchanged."
|
say_cyan -e "Current display manager is already **SDDM**. Leaving unchanged."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user