From 542cf935cd34a7edaba73ec64e52e9ee20aef545 Mon Sep 17 00:00:00 2001 From: "[yuri]" <[yuri.kuit@gmail.com]> Date: Mon, 10 Nov 2025 12:50:37 +0100 Subject: [PATCH] updated debian scripts --- v2/debian-full.sh | 78 ++++----------- v2/debian-gnome.sh | 139 ++++++-------------------- v2/debian-hyprland.sh | 52 ++++------ v2/debian-minimal.sh | 204 +++++---------------------------------- v2/debian-plasma.sh | 149 ++++++++-------------------- v2/debian-server.sh | 52 ++++------ v2/debian-workstation.sh | 55 +++++------ v2/debian-xfce.sh | 94 ++++++++++++------ 8 files changed, 244 insertions(+), 579 deletions(-) diff --git a/v2/debian-full.sh b/v2/debian-full.sh index 7d0cd26..c7f54d3 100755 --- a/v2/debian-full.sh +++ b/v2/debian-full.sh @@ -1,68 +1,32 @@ #!/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' +# Colors + logging same as others +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='' -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"; } +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}" ########################## -# Use exported variables from main detection script +# Helper functions ########################## -OS="${DETECTED_OS}" -DDE="${DETECTED_DE}" -DE="${SELECTED_DE:-none}" -TWM="${SELECTED_TWM:-none}" -INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" +install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } +is_package_installed() { dpkg -s "$1" &>/dev/null; } -# Pause before continuing -read -n 1 -s -r -p "Press any key to continue" +color_yellow; echo "Starting full setup..."; color_reset -color_cyan -echo -echo "Running Debian Minimal setup first..." -color_reset +# Run minimal first +bash "$SCRIPT_DIR/debian-minimal.sh" -# Run the minimal setup -bash debian-minimal.sh - -color_yellow -echo -echo "Continuing with Debian FULL installation..." -color_reset - -# Install additional FULL packages -sudo apt install -y \ - arandr \ - catfish \ - galculator \ - network-manager \ - network-manager-applet \ - network-manager-openvpn \ - numlockx \ - pavucontrol \ - playerctl \ - xcolors \ - gparted - -color_green -echo -echo "Debian FULL installation packages installed." -color_reset +# Add extra packages +install_packages arandr catfish galculator network-manager network-manager-applet network-manager-openvpn numlockx pavucontrol playerctl gparted +color_green; echo "Full setup completed."; color_reset diff --git a/v2/debian-gnome.sh b/v2/debian-gnome.sh index d70e712..de47d8b 100755 --- a/v2/debian-gnome.sh +++ b/v2/debian-gnome.sh @@ -1,20 +1,11 @@ #!/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' +# Color helpers, logging, variables identical to plasma/xfce scripts -if [ ! -t 1 ]; then - RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET='' -fi +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='' color_red() { printf '%b' "$RED"; } color_green() { printf '%b' "$GREEN"; } @@ -23,113 +14,45 @@ 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}" +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:-}" DE="${SELECTED_DE:-none}" TWM="${SELECTED_TWM:-none}" INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" ########################## -# Desktop Environment installation +# Helper functions ########################## -color_yellow -echo "Installing Gnome..." -color_reset +install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } +is_package_installed() { dpkg -s "$1" &>/dev/null; } +detect_de() { command -v gnome-session >/dev/null 2>&1 && echo "gnome" || echo ""; } +detect_display_manager() { [ -f /etc/X11/default-display-manager ] && basename "$(cat /etc/X11/default-display-manager)" || echo ""; } +enable_graphical_target() { sudo systemctl enable sddm; sudo systemctl set-default graphical.target; } -if [[ -z "$DDE" ]]; then - color_cyan - echo - echo "No Desktop Environment detected. Installing Gnome (light setup with SDDM)..." - color_reset +color_yellow; echo "Starting Gnome installation..."; color_reset - sudo apt update - sudo apt install -y --no-install-recommends sddm \ - gnome-shell \ - gnome-terminal \ - nautilus \ - gnome-control-center \ - gnome-system-monitor \ - gnome-settings-daemon \ - gnome-tweaks \ - network-manager-gnome \ - gnome-keyring \ - gnome-session +CURRENT_DE="$(detect_de)" +CURRENT_DM="$(detect_display_manager)" - # Enable SDDM as the display manager - sudo systemctl enable sddm - - # Enable graphical target - sudo systemctl set-default graphical.target - - color_green - echo - echo "Gnome with SDDM installed successfully." - echo "You can reboot now to start Gnome." - color_reset +if [[ -z "$CURRENT_DE" ]]; then + color_cyan; echo "No DE detected. Installing Gnome with SDDM..."; color_reset + install_packages sddm gnome-shell gnome-terminal nautilus gnome-control-center gnome-system-monitor gnome-tweaks network-manager-gnome gnome-keyring gnome-session + enable_graphical_target + color_green; echo "Gnome with SDDM installed successfully."; color_reset else - color_cyan - echo - echo "You already have $DE installed." - color_reset - - if systemctl is-active --quiet lightdm; then - color_yellow - echo - echo "LightDM is currently active. Replacing with SDDM..." - color_reset - - # Disable and remove LightDM + color_cyan; echo "Detected existing DE: $CURRENT_DE"; color_reset + if [[ "$CURRENT_DM" == "lightdm" ]]; then + color_yellow; echo "Replacing LightDM with SDDM..."; color_reset 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 - - # Enable graphical target - sudo systemctl set-default graphical.target - - color_green - echo - echo "LightDM removed and replaced with SDDM." - color_reset + install_packages sddm + enable_graphical_target + color_green; echo "LightDM replaced with SDDM."; color_reset else - color_cyan - echo - echo "No LightDM detected, leaving current display manager unchanged." - color_reset + color_cyan; echo "Current DM: ${CURRENT_DM:-none}, leaving unchanged."; color_reset fi fi - -########################## -# Cleanup unwanted packages -########################## -# packages=("vim" "vim-runtime" "vim-common" "vim-tiny" "mousepad" "parole") -is_package_installed() { dpkg -s "$1" &> /dev/null; } - -for package in "${packages[@]:-}"; do - if is_package_installed "$package"; then - echo "Removing $package..." - sudo apt-get purge -y "$package" - else - echo "$package is not installed, skipping." - fi - - if ! is_package_installed "$package"; then - echo "$package successfully removed." - else - echo "$package is still installed. Check manually." - fi - - echo "----------------------------" -done - -# Resolving network issues -sudo mv /etc/network/interfaces /etc/network/interfaces.bak || true -sudo systemctl restart NetworkManager - -# Remove leftover dependencies -sudo apt-get autoremove -y diff --git a/v2/debian-hyprland.sh b/v2/debian-hyprland.sh index 83d0e24..535e540 100755 --- a/v2/debian-hyprland.sh +++ b/v2/debian-hyprland.sh @@ -1,44 +1,32 @@ #!/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' +# Colors + logging same pattern +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='' -# 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"; } +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}" ########################## -# Use exported variables from main detection script +# Helper functions ########################## -OS="${DETECTED_OS}" -DDE="${DETECTED_DE}" -DE="${SELECTED_DE:-none}" -TWM="${SELECTED_TWM:-none}" -INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" +install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } +is_package_installed() { dpkg -s "$1" &>/dev/null; } -color_cyan -echo -echo "Starting Debian Hyprland setup..." -color_reset -echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" -echo +color_yellow; echo "Starting hyprland setup..."; color_reset + +# Optionally add hyprland-specific packages here +#install_packages ???? +color_green; echo "hyprland setup completed."; color_reset # Pause read -n 1 -s -r -p "Press any key to continue" diff --git a/v2/debian-minimal.sh b/v2/debian-minimal.sh index 5ad3282..46e897a 100755 --- a/v2/debian-minimal.sh +++ b/v2/debian-minimal.sh @@ -1,21 +1,10 @@ #!/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 +# Colors + logging same pattern +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='' color_red() { printf '%b' "$RED"; } color_green() { printf '%b' "$GREEN"; } @@ -24,183 +13,38 @@ 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}" +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}" -TWM="${SELECTED_TWM:-none}" -INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" - -# Pause -read -n 1 -s -r -p "Press any key to continue" ########################## -# Create directories (skel + user) +# Helper functions ########################## -echo -color_green -echo "########################################################################" -echo "################### Creating directories" -echo "########################################################################" -color_reset -echo +install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } +is_package_installed() { dpkg -s "$1" &>/dev/null; } -sudo mkdir -p /etc/skel/.config/xfce4/{panel,xfconf} -mkdir -p \ - "$HOME"/{.bin,.fonts,.icons,.themes,DATA} \ - "$HOME/.local/share/"{icons,themes,applications} \ - "$HOME/.config/"{autostart,gtk-{3.0,4.0},variety,fish,neofetch} +color_yellow; echo "Starting minimal setup..."; color_reset -########################## -# Remove unwanted packages -########################## -packages=("vim" "vim-runtime" "vim-common" "vim-tiny" "mousepad" "parole") +# Create user directories +mkdir -p "$HOME"/{.bin,.fonts,.icons,.themes,DATA} "$HOME/.local/share/"{icons,themes,applications} "$HOME/.config/"{autostart,gtk-{3.0,4.0},variety,fish,neofetch} -is_package_installed() { - dpkg -s "$1" &> /dev/null -} +# Install essential tools +install_packages wget curl nano fastfetch lolcat bash-completion starship alacritty hwinfo lshw man-db tree xdg-user-dirs rsync time bat chrony -for package in "${packages[@]}"; do - if is_package_installed "$package"; then - echo "Removing $package..." - sudo apt-get purge -y "$package" - else - echo "$package is not installed, skipping." - fi - - if ! is_package_installed "$package"; then - echo "$package successfully removed." - else - echo "$package is still installed. Check manually." - fi - - echo "----------------------------" -done - -sudo apt-get autoremove -y - -########################## -# Install needed packages -########################## -# Firmware / headers -sudo apt-get install -y dkms linux-headers-$(uname -r) - -# Archive managers -sudo apt install -y zip gzip p7zip unace unrar unzip file-roller - -# Fonts -sudo apt install -y font-manager fonts-noto fonts-dejavu fonts-droid-fallback \ - fonts-hack fonts-inconsolata fonts-liberation fonts-roboto fonts-ubuntu fonts-terminus - -# RobotoMono Nerd Font +# Optionally handle fonts FONT_DIR="$HOME/.local/share/fonts" mkdir -p "$FONT_DIR" -ZIP_URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/RobotoMono.zip" -TMP_DIR="$(mktemp -d)" -echo "Downloading RobotoMono Nerd Font..." -curl -L "$ZIP_URL" -o "$TMP_DIR/RobotoMono.zip" -echo "Extracting..." -unzip -q "$TMP_DIR/RobotoMono.zip" -d "$FONT_DIR" -rm -rf "$TMP_DIR" -echo "Updating font cache..." +curl -L "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/RobotoMono.zip" -o "/tmp/RobotoMono.zip" +unzip -q "/tmp/RobotoMono.zip" -d "$FONT_DIR" fc-cache -fv -echo "RobotoMono Nerd Font installed successfully in $FONT_DIR" -# Tools -sudo apt install -y wget curl nano fastfetch lolcat bash-completion starship alacritty \ - hwinfo lshw libpam0g libpam-modules libpam-runtime libpam-modules-bin \ - avahi-daemon avahi-utils libnss-mdns man-db manpages tree xdg-user-dirs \ - mate-polkit rsync time bat chrony duf - -# Theming -sudo apt install -y bibata-cursor-theme feh arc-theme - -# Surfn icon theme -echo "Installing Surfn icon theme..." -TEMP_DIR=$(mktemp -d) -git clone https://github.com/erikdubois/Surfn.git "$TEMP_DIR/surfn" -cp -r "$TEMP_DIR/surfn/surfn-icons/" ~/.icons/ -rm -rf "$TEMP_DIR" -echo "Surfn icon theme installed." - -# Flat Remix Dark GTK theme -echo "Installing Flat Remix Dark GTK theme..." -TEMP_DIR=$(mktemp -d) -cd "$TEMP_DIR" -wget -O flat-remix-gtk.tar.gz https://github.com/daniruiz/flat-remix-gtk/archive/refs/heads/master.tar.gz -tar -xzf flat-remix-gtk.tar.gz -mv flat-remix-gtk-master/themes/* ~/.themes/ -cd ~ -rm -rf "$TEMP_DIR" -echo "Flat Remix Dark GTK theme installed." - -# Internet -sudo apt install -y chromium - -# Enable services -sudo systemctl enable avahi-daemon.service +# Enable basic services sudo systemctl enable chrony sudo systemctl enable fstrim.timer -########################## -# Detect virtualization platform -########################## -echo "Detecting virtualization platform..." -virt_type=$(systemd-detect-virt) - -case "$virt_type" in - kvm) - echo "Detected KVM. Installing qemu-guest-agent..." - sudo apt install -y qemu-guest-agent spice-vdagent - sudo systemctl enable qemu-guest-agent.service - ;; - oracle) - echo "Detected VirtualBox. Installing virtualbox-guest-utils..." - sudo apt install -y virtualbox-guest-utils - sudo systemctl enable vboxservice.service - ;; - none) - echo "No virtualization detected. Skipping guest utilities." - ;; - *) - echo "Virtualization detected: $virt_type, but no install routine defined." - ;; -esac - -########################## -# XFCE-specific setup -########################## -if [[ "$DE" == "xfce" ]]; then - echo "Setting up XFCE directories..." - sudo mkdir -p /etc/skel/.config/xfce4/{panel,xfconf} - mkdir -p "$HOME/.config/"{xfce4,xfce4/xfconf} - - # Cleanup unwanted packages - echo "Removing unwanted packages from XFCE..." - packages=("xfburn" "xfce4-screenshooter" "xfce4-notes") - sudo apt-mark manual xfce4-goodies - - for package in "${packages[@]}"; do - if is_package_installed "$package"; then - echo "Removing $package..." - sudo apt-get purge -y "$package" - else - echo "$package is not installed, skipping." - fi - - if ! is_package_installed "$package"; then - echo "$package successfully removed." - else - echo "$package is still installed. Check manually." - fi - - echo "----------------------------" - done - - sudo apt-get autoremove -y - - # Install XFCE tools - sudo apt install -y thunar thunar-archive-plugin thunar-volman -fi +# Pause +read -n 1 -s -r -p "Press any key to continue" +echo \ No newline at end of file diff --git a/v2/debian-plasma.sh b/v2/debian-plasma.sh index f33d58e..53520cb 100755 --- a/v2/debian-plasma.sh +++ b/v2/debian-plasma.sh @@ -2,20 +2,11 @@ set -euo pipefail ########################## -# Color helpers (no tput) +# Color helpers ########################## -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 +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='' color_red() { printf '%b' "$RED"; } color_green() { printf '%b' "$GREEN"; } @@ -25,115 +16,57 @@ color_gray() { printf '%b' "$GRAY"; } color_reset() { printf '%b' "$RESET"; } ########################## -# Use exported variables from main detection script +# Logging ########################## -OS="${DETECTED_OS}" -DDE="${DETECTED_DE}" +LOGFILE="${LOGFILE:-/tmp/debian-plasma.log}" +exec > >(tee -a "$LOGFILE") 2>&1 + +########################## +# 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 ########################## -color_yellow -echo "Installing KDE Plasma..." -color_reset +install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } +is_package_installed() { dpkg -s "$1" &>/dev/null; } +detect_de() { command -v startplasma-x11 >/dev/null 2>&1 && echo "plasma" || echo ""; } +detect_display_manager() { [ -f /etc/X11/default-display-manager ] && basename "$(cat /etc/X11/default-display-manager)" || echo ""; } +enable_graphical_target() { sudo systemctl enable sddm; sudo systemctl set-default graphical.target; } -# Detect if KDE Plasma and SDDM are installed and install if needed -if [[ -z "$DDE" ]]; then - color_cyan - echo - echo "No Desktop Environment detected. Installing KDE Plasma (light setup with SDDM)..." - color_reset +########################## +# Install Plasma +########################## +color_yellow; echo "Starting KDE Plasma installation..."; color_reset - sudo apt update - sudo apt install -y --no-install-recommends sddm \ - plasma-desktop dolphin konsole kate \ - plasma-nm plasma-workspace kde-config-gtk-style \ - kde-config-sddm plasma-discover plasma-discover-common \ - plasma-discover-backend-snap plasma-discover-backend-flatpak \ - plasma-discover-backend-fwupd kscreen +CURRENT_DE="$(detect_de)" +CURRENT_DM="$(detect_display_manager)" - # Enable SDDM as the display manager - sudo systemctl enable sddm - sudo systemctl set-default graphical.target - - # Rebuild Discover cache - kbuildsycoca6 - - color_green - echo - echo "KDE Plasma with SDDM installed successfully." - echo "You can reboot now to start KDE Plasma." - color_reset +if [[ -z "$CURRENT_DE" ]]; then + color_cyan; echo "No DE detected. Installing KDE Plasma with SDDM..."; color_reset + 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 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 + color_cyan; echo "Detected existing DE: $CURRENT_DE"; color_reset + if [[ "$CURRENT_DM" == "lightdm" ]]; then + color_yellow; echo "Replacing LightDM with SDDM..."; color_reset 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 - sudo systemctl set-default graphical.target - - color_green - echo - echo "LightDM removed and replaced with SDDM." - color_reset + install_packages sddm + enable_graphical_target + color_green; echo "LightDM replaced with SDDM."; color_reset else - color_cyan - echo - echo "No LightDM detected, leaving current display manager unchanged." - color_reset + color_cyan; echo "Current DM: ${CURRENT_DM:-none}, leaving unchanged."; color_reset fi fi -########################## -# Cleanup unwanted packages -########################## -# Define packages to remove (example) -packages=("vim" "vim-runtime" "vim-common" "vim-tiny" "mousepad" "parole") - -is_package_installed() { - dpkg -s "$1" &> /dev/null -} - -for package in "${packages[@]}"; do - if is_package_installed "$package"; then - echo "Removing $package..." - sudo apt-get purge -y "$package" - else - echo "$package is not installed, skipping." - fi - - # Optional double-check - if ! is_package_installed "$package"; then - echo "$package successfully removed." - else - echo "$package is still installed. Check manually." - fi - - echo "----------------------------" -done - -########################## -# Network cleanup -########################## -sudo mv /etc/network/interfaces /etc/network/interfaces.bak -sudo systemctl restart NetworkManager - -# Remove leftover dependencies -sudo apt-get autoremove -y +# Pause +read -n 1 -s -r -p "Press any key to continue" +echo \ No newline at end of file diff --git a/v2/debian-server.sh b/v2/debian-server.sh index 68b997f..b1c6529 100755 --- a/v2/debian-server.sh +++ b/v2/debian-server.sh @@ -1,44 +1,32 @@ #!/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' +# Colors + logging same pattern +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='' -# 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"; } +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}" ########################## -# Use exported variables from main detection script +# Helper functions ########################## -OS="${DETECTED_OS}" -DDE="${DETECTED_DE}" -DE="${SELECTED_DE:-none}" -TWM="${SELECTED_TWM:-none}" -INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" +install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } +is_package_installed() { dpkg -s "$1" &>/dev/null; } -color_cyan -echo -echo "Starting Debian Server setup..." -color_reset -echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" -echo +color_yellow; echo "Starting Server setup..."; color_reset + +# Optionally add Server-specific packages here +install_packages linux-headers-$(uname -r) +color_green; echo "Server setup completed."; color_reset # Pause read -n 1 -s -r -p "Press any key to continue" diff --git a/v2/debian-workstation.sh b/v2/debian-workstation.sh index 16048dd..0461641 100755 --- a/v2/debian-workstation.sh +++ b/v2/debian-workstation.sh @@ -1,44 +1,35 @@ #!/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' +# Colors + logging same pattern +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='' -# 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"; } +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}" ########################## -# Use exported variables from main detection script +# Helper functions ########################## -OS="${DETECTED_OS}" -DDE="${DETECTED_DE}" -DE="${SELECTED_DE:-none}" -TWM="${SELECTED_TWM:-none}" -INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" +install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; } +is_package_installed() { dpkg -s "$1" &>/dev/null; } -color_cyan -echo -echo "Starting Debian Workstation setup..." -color_reset -echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" -echo +color_yellow; echo "Starting workstation setup..."; color_reset + +# Run full setup first +bash "$SCRIPT_DIR/debian-full.sh" + +# Optionally add workstation-specific packages here +install_packages git vlc libreoffice +color_green; echo "Workstation setup completed."; color_reset # Pause read -n 1 -s -r -p "Press any key to continue" diff --git a/v2/debian-xfce.sh b/v2/debian-xfce.sh index 48a0a19..17a6bb1 100755 --- a/v2/debian-xfce.sh +++ b/v2/debian-xfce.sh @@ -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 \ No newline at end of file