removed logging and fixed colors

This commit is contained in:
[yuri]
2025-11-10 15:16:05 +01:00
parent af8f6078cf
commit aa7f8e97d0
9 changed files with 14 additions and 69 deletions

View File

@@ -22,22 +22,14 @@ fi
color_yellow() { printf '%b' "$YELLOW"; }
color_cyan() { printf '%b' "$CYAN"; }
color_red() { printf '%b' "$RED"; }
color_green() { printf '%b' "$GREEN"; }
color_reset() { printf '%b' "$RESET"; }
##########################
# Optional logging setup
##########################
LOG_DIR="./logs"
LOG_FILE="$LOG_DIR/setup.log"
mkdir -p "$LOG_DIR"
exec > >(tee -a "$LOG_FILE") 2>&1
##########################
# Script Version Selection
##########################
SCRIPT_VERSION="${SCRIPT_VERSION:-v1}" # Default to v1 if not set
# Optional: ask user which version to use (uncomment if you want interactivity)
echo
echo "Select script version:"
echo " 1) v1 (legacy)"
@@ -46,7 +38,6 @@ read -rp "Enter choice [1/2] (default: 2): " ver_choice
case "$ver_choice" in
1) SCRIPT_VERSION="v1" ;;
*) SCRIPT_VERSION="v2" ;;
esac
echo
@@ -63,6 +54,9 @@ if [[ ! -d "./${SCRIPT_VERSION}" ]]; then
exit 1
fi
##########################
# OS Detection
##########################
echo
color_yellow
echo "################################################################"
@@ -71,9 +65,6 @@ echo "################################################################"
color_reset
echo
##########################
# OS Detection
##########################
source /etc/os-release
OS_ID="${ID,,}"
@@ -217,7 +208,6 @@ color_reset
echo
INSTALL_LEVEL="minimal" # default
while true; do
echo
echo "Select installation level:"
@@ -252,7 +242,7 @@ export SELECTED_TWM="$TWM"
export INSTALL_LEVEL
##########################
# Determine OS script (with version)
# Determine OS script
##########################
case "$OS" in
debian) OS_SCRIPT="./${SCRIPT_VERSION}/debian.sh" ;;
@@ -269,7 +259,7 @@ case "$OS" in
esac
##########################
# Preflight check
# Preflight check & run
##########################
if [[ ! -f "$OS_SCRIPT" ]]; then
color_red
@@ -280,13 +270,9 @@ if [[ ! -f "$OS_SCRIPT" ]]; then
fi
if [[ ! -x "$OS_SCRIPT" ]]; then
echo "Fixing permissions on $OS_SCRIPT..."
chmod +x "$OS_SCRIPT"
fi
##########################
# Run OS script (always via Bash)
##########################
echo
color_cyan
echo "Running OS script: $OS_SCRIPT"
@@ -305,5 +291,3 @@ echo "################################################################"
echo "End Detection"
echo "################################################################"
color_reset
echo
echo "Logs saved to: $LOG_FILE"

View File

@@ -10,9 +10,6 @@ color_yellow() { printf '%b' "$YELLOW"; }
color_green() { printf '%b' "$GREEN"; }
color_reset() { printf '%b' "$RESET"; }
LOGFILE="${LOGFILE:-/tmp/debian-full.log}"
exec > >(tee -a "$LOGFILE") 2>&1
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}"

View File

@@ -14,9 +14,6 @@ color_cyan() { printf '%b' "$CYAN"; }
color_gray() { printf '%b' "$GRAY"; }
color_reset() { printf '%b' "$RESET"; }
LOGFILE="${LOGFILE:-/tmp/debian-gnome.log}"
exec > >(tee -a "$LOGFILE") 2>&1
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}"
DDE="${DETECTED_DE:-}"

View File

@@ -10,9 +10,6 @@ color_yellow() { printf '%b' "$YELLOW"; }
color_green() { printf '%b' "$GREEN"; }
color_reset() { printf '%b' "$RESET"; }
LOGFILE="${LOGFILE:-/tmp/debian-hyprland.log}"
exec > >(tee -a "$LOGFILE") 2>&1
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}"

View File

@@ -13,9 +13,6 @@ color_cyan() { printf '%b' "$CYAN"; }
color_gray() { printf '%b' "$GRAY"; }
color_reset() { printf '%b' "$RESET"; }
LOGFILE="${LOGFILE:-/tmp/debian-minimal.log}"
exec > >(tee -a "$LOGFILE") 2>&1
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}"
DE="${SELECTED_DE:-none}"

View File

@@ -15,12 +15,6 @@ color_cyan() { printf '%b' "$CYAN"; }
color_gray() { printf '%b' "$GRAY"; }
color_reset() { printf '%b' "$RESET"; }
##########################
# Logging
##########################
LOGFILE="${LOGFILE:-/tmp/debian-plasma.log}"
exec > >(tee -a "$LOGFILE") 2>&1
##########################
# Variables
##########################

View File

@@ -10,9 +10,6 @@ color_yellow() { printf '%b' "$YELLOW"; }
color_green() { printf '%b' "$GREEN"; }
color_reset() { printf '%b' "$RESET"; }
LOGFILE="${LOGFILE:-/tmp/debian-server.log}"
exec > >(tee -a "$LOGFILE") 2>&1
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}"

View File

@@ -10,9 +10,6 @@ color_yellow() { printf '%b' "$YELLOW"; }
color_green() { printf '%b' "$GREEN"; }
color_reset() { printf '%b' "$RESET"; }
LOGFILE="${LOGFILE:-/tmp/debian-workstation.log}"
exec > >(tee -a "$LOGFILE") 2>&1
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OS="${DETECTED_OS:-debian}"

View File

@@ -12,11 +12,6 @@ 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"; }
@@ -24,17 +19,9 @@ color_cyan() { printf '%b' "$CYAN"; }
color_gray() { printf '%b' "$GRAY"; }
color_reset() { printf '%b' "$RESET"; }
##########################
# Optional logging
##########################
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}"
@@ -78,35 +65,33 @@ enable_graphical_target() {
##########################
# Start installation
##########################
echo "${YELLOW}Starting XFCE installation...${RESET}"
echo -e "${YELLOW}Starting XFCE installation...${RESET}"
CURRENT_DE="$(detect_de)"
CURRENT_DM="$(detect_display_manager)"
if [[ -z "$CURRENT_DE" ]]; then
echo "${CYAN}No Desktop Environment detected. Installing XFCE (light setup with SDDM)...${RESET}"
echo -e "${CYAN}No Desktop Environment detected. Installing XFCE (light setup with SDDM)...${RESET}"
install_packages sddm xfce4 xfce4-goodies
enable_graphical_target
echo "${GREEN}XFCE with SDDM installed successfully. You can reboot now to start XFCE.${RESET}"
echo -e "${GREEN}XFCE with SDDM installed successfully. You can reboot now to start XFCE.${RESET}"
else
echo "${CYAN}Detected existing Desktop Environment: $CURRENT_DE${RESET}"
echo -e "${CYAN}Detected existing Desktop Environment: $CURRENT_DE${RESET}"
if [[ "$CURRENT_DM" == "lightdm" ]]; then
echo "${YELLOW}LightDM is currently active. Replacing with SDDM...${RESET}"
echo -e "${YELLOW}LightDM is currently active. Replacing with SDDM...${RESET}"
sudo systemctl disable lightdm
sudo apt purge -y lightdm lightdm-gtk-greeter
install_packages sddm
enable_graphical_target
echo "${GREEN}LightDM removed and replaced with SDDM.${RESET}"
echo -e "${GREEN}LightDM removed and replaced with SDDM.${RESET}"
else
echo "${CYAN}Current display manager: ${CURRENT_DM:-none}. Leaving unchanged.${RESET}"
echo -e "${CYAN}Current display manager: ${CURRENT_DM:-none}. Leaving unchanged.${RESET}"
fi
fi
@@ -116,4 +101,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 "${GREEN}XFCE / SDDM setup completed.${RESET}"
echo -e "${GREEN}XFCE / SDDM setup completed.${RESET}"