106 lines
3.6 KiB
Bash
Executable File
106 lines
3.6 KiB
Bash
Executable File
#!/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 "%b%s%b\n" "$RED" "$*" "$RESET"; }
|
|
say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
|
|
say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
|
|
say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
|
|
say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
|
|
say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
|
|
|
|
##########################
|
|
# Use exported variables from main detection script
|
|
##########################
|
|
OS="${DETECTED_OS:-debian}"
|
|
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 apt update; sudo apt install -y --no-install-recommends "$@"; }
|
|
is_package_installed() { dpkg -s "$1" &>/dev/null; }
|
|
|
|
say_yellow "Starting full setup..."
|
|
|
|
# Run minimal first
|
|
bash "$SCRIPT_DIR/debian-minimal.sh"
|
|
|
|
# Add extra packages
|
|
install_packages arandr catfish galculator network-manager network-manager-applet network-manager-openvpn numlockx pavucontrol playerctl gparted
|
|
|
|
# Ensure NetworkManager manages all interfaces
|
|
echo "Setting NetworkManager to manage all interfaces..."
|
|
sudo cp /etc/network/interfaces /etc/network/interfaces.bak.$(date +%s)
|
|
sudo tee /etc/network/interfaces > /dev/null <<'EOF'
|
|
auto lo
|
|
iface lo inet loopback
|
|
EOF
|
|
sudo sed -i 's/^managed=.*/managed=true/' /etc/NetworkManager/NetworkManager.conf || \
|
|
echo -e "[ifupdown]\nmanaged=true" | sudo tee -a /etc/NetworkManager/NetworkManager.conf
|
|
sudo systemctl restart NetworkManager
|
|
|
|
########################################
|
|
# XFCE-specific configuration
|
|
########################################
|
|
if [[ "${DE}" == "xfce" || "${DDE}" == "xfce" ]]; then
|
|
echo
|
|
say_cyan "Applying XFCE defaults: fonts, browser, and terminal..."
|
|
|
|
# Ensure xfconf-query exists (for XFCE settings)
|
|
if ! command -v xfconf-query >/dev/null 2>&1; then
|
|
say_yellow "xfconf-query not found — installing xfce4-settings..."
|
|
install_packages xfce4-settings
|
|
fi
|
|
|
|
# set fonts
|
|
# Wait for xfconf to be available (only needed if running inside the same session)
|
|
if command -v xfconf-query >/dev/null 2>&1; then
|
|
# Interface font (UI)
|
|
xfconf-query -c xsettings -p /Gtk/FontName -s "RobotoMono Nerd Font Regular 10"
|
|
# Monospace font (terminals, editors)
|
|
xfconf-query -c xsettings -p /Gtk/MonospaceFontName -s "RobotoMono Nerd Font Mono Regular 10"
|
|
|
|
say_green "XFCE fonts updated successfully!"
|
|
else
|
|
say_yellow "xfconf-query not found — skipping XFCE font config (will apply at first login)."
|
|
fi
|
|
|
|
# System-wide browser default (if running as root)
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
if command -v chromium >/dev/null 2>&1; then
|
|
update-alternatives --set x-www-browser /usr/bin/chromium || true
|
|
fi
|
|
else
|
|
# Per-user default browser using xdg-settings
|
|
if command -v chromium >/dev/null 2>&1; then
|
|
xdg-settings set default-web-browser chromium.desktop 2>/dev/null || true
|
|
fi
|
|
fi
|
|
|
|
say_green "XFCE defeault browser set to chromium!"
|
|
fi
|
|
fi
|
|
|
|
# End of script
|
|
say_green "Full setup completed."
|