diff --git a/v2/arch-full.sh b/v2/arch-full.sh new file mode 100755 index 0000000..a97d01f --- /dev/null +++ b/v2/arch-full.sh @@ -0,0 +1,162 @@ +#!/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:-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 pacman -Sy; sudo pacman -S --noconfirm --needed "$@"; } +is_package_installed() { pacman -Qi "$@" &>/dev/null; } +remove_packages() { + local packages_to_remove=() + + # 1. Identify which packages are actually installed + for pkg in "$@"; do + if is_package_installed "$pkg"; then + packages_to_remove+=("$pkg") + else + say_gray "Package '$pkg' not found. Skipping removal." + fi + done + + # 2. Only run pacman if there are packages to remove + if [ ${#packages_to_remove[@]} -gt 0 ]; then + say_cyan "Removing packages: ${packages_to_remove[*]}" + sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true + else + say_gray "No packages to remove from the list." + fi +} + +say_yellow "Starting full setup..." + +# Run minimal first +bash "$SCRIPT_DIR/arch-minimal.sh" + +# Add extra packages +install_packages arandr catfish galculator networkmanager network-manager-applet networkmanager-openvpn numlockx pipewire pipewire-alsa pipewire-pulse wireplumber pavucontrol playerctl gparted xfce4-indicator-plugin xfce4-pulseaudio-plugin xfce4-clipman-plugin + +# Ensure NetworkManager manages all interfaces +say_yellow "Ensuring NetworkManager service is enabled and running..." +sudo systemctl enable --now NetworkManager + +say_yellow "Setting NetworkManager to globally manage all devices..." +sudo tee /etc/NetworkManager/conf.d/10-globally-managed-devices.conf > /dev/null <<'EOF' +[ifupdown] +managed=true + +[keyfile] +unmanaged-devices= +EOF + +say_yellow "Restarting NetworkManager service..." +sudo systemctl restart NetworkManager + +# Enable pipewire +systemctl --user enable pipewire pipewire-pulse wireplumber + +######################################## +# 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 + + # Set browser default + if command -v chromium >/dev/null 2>&1; then + mkdir -p "$HOME/.config/xfce4/" + HELPERS_FILE="$HOME/.config/xfce4/helpers.rc" + + # Ensure the helpers file exists + touch "$HELPERS_FILE" + + # Update or insert browser entry + if grep -q '^WebBrowser=' "$HELPERS_FILE"; then + sed -i 's|^WebBrowser=.*|WebBrowser=chromium|' "$HELPERS_FILE" + else + echo "WebBrowser=chromium" >> "$HELPERS_FILE" + fi + say_green "XFCE defeault browser set to chromium!" + fi + + # Set default terminal + if command -v alacritty >/dev/null 2>&1; then + mkdir -p "$HOME/.config/xfce4/" + HELPERS_FILE="$HOME/.config/xfce4/helpers.rc" + + touch "$HELPERS_FILE" + + # TerminalEmulator entry + if grep -q '^TerminalEmulator=' "$HELPERS_FILE"; then + sed -i 's|^TerminalEmulator=.*|TerminalEmulator=alacritty|' "$HELPERS_FILE" + else + echo "TerminalEmulator=alacritty" >> "$HELPERS_FILE" + fi + + # TerminalEmulatorCommand entry + if grep -q '^TerminalEmulatorCommand=' "$HELPERS_FILE"; then + sed -i 's|^TerminalEmulatorCommand=.*|TerminalEmulatorCommand=alacritty|' "$HELPERS_FILE" + else + echo "TerminalEmulatorCommand=alacritty" >> "$HELPERS_FILE" + fi + say_green "XFCE defeault terminal set to alacritty!" + fi +fi + +# replace bashrc +say_yellow "making backup of bashrc" +sudo cp -v /etc/skel/.bashrc /etc/skel/.bashrc.starburst + +# End of script +say_green "Full setup completed." diff --git a/v2/arch-hyprland.sh b/v2/arch-hyprland.sh new file mode 100755 index 0000000..c377dac --- /dev/null +++ b/v2/arch-hyprland.sh @@ -0,0 +1,118 @@ +#!/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:-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 pacman -Sy; sudo pacman -S --noconfirm --needed "$@"; } +is_package_installed() { pacman -Qi "$@" &>/dev/null; } +remove_packages() { + local packages_to_remove=() + + # 1. Identify which packages are actually installed + for pkg in "$@"; do + if is_package_installed "$pkg"; then + packages_to_remove+=("$pkg") + else + say_gray "Package '$pkg' not found. Skipping removal." + fi + done + + # 2. Only run pacman if there are packages to remove + if [ ${#packages_to_remove[@]} -gt 0 ]; then + say_cyan "Removing packages: ${packages_to_remove[*]}" + sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true + else + say_gray "No packages to remove from the list." + fi +} + +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 +########################## +say_yellow "Starting hyprland setup..." + +CURRENT_DE="$(detect_de)" +CURRENT_DM="$(detect_display_manager)" + +if [[ -z "$CURRENT_DE" ]]; then + say_cyan -e "No Desktop Environment detected. Installing Hyprland (light setup with SDDM)..." + + install_packages sddm hyprland dunst grim kitty polkit-kde-agent qt5-wayland qt6-wayland slurp uwsm wofi xdg-desktop-portal-hyprland + enable_graphical_target + + say_green -e "Hyprland with SDDM installed successfully. You can reboot now to start Hyprland." +else + say_cyan -e "Detected existing Desktop Environment: $CURRENT_DE" + + if [[ "$CURRENT_DM" == "lightdm" ]]; then + say_yellow -e "LightDM is currently active. Replacing with SDDM..." + + sudo systemctl disable lightdm + sudo apt purge -y lightdm lightdm-gtk-greeter + + install_packages sddm + enable_graphical_target + + say_green -e "LightDM removed and replaced with SDDM." + else + say_cyan -e "Current display manager: ${CURRENT_DM:-none}. Leaving unchanged." + fi +fi + +# End of script +say_green -e "Hyprland / SDDM setup completed." \ No newline at end of file diff --git a/v2/arch-minimal.sh b/v2/arch-minimal.sh new file mode 100755 index 0000000..1840b68 --- /dev/null +++ b/v2/arch-minimal.sh @@ -0,0 +1,171 @@ +#!/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:-arch}" +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 -Sy; sudo pacman -S --noconfirm --needed "$@"; } +is_package_installed() { pacman -Qi "$@" &>/dev/null; } +remove_packages() { + local packages_to_remove=() + + # 1. Identify which packages are actually installed + for pkg in "$@"; do + if is_package_installed "$pkg"; then + packages_to_remove+=("$pkg") + else + say_gray "Package '$pkg' not found. Skipping removal." + fi + done + + # 2. Only run pacman if there are packages to remove + if [ ${#packages_to_remove[@]} -gt 0 ]; then + say_cyan "Removing packages: ${packages_to_remove[*]}" + sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true + else + say_gray "No packages to remove from the list." + fi +} + +say_yellow "Starting minimal setup..." + +# 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} + +# Removing unwanted drivers +say_yellow "GET RID OF BROADCOM AND REALTEK DRIVERS" +remove_packages broadcom-wl-dkms r8168-dkms rtl8821cu-morrownr-dkms-git + +# Removing unwanted kernels +say_yellow "KEEP LINUX KERNEL GET RID OF THE OTHER KERNELS" +# Ensure at least one kernel remains +if pacman -Qi linux &> /dev/null && pacman -Qi linux-headers &> /dev/null; then + + # Define all the kernels and their headers you want to remove + KERNELS_TO_REMOVE=( + linux-lts-headers linux-lts + linux-zen-headers linux-zen + linux-hardened-headers linux-hardened + linux-rt-headers linux-rt + linux-rt-lts-headers linux-rt-lts + linux-cachyos-headers linux-cachyos + linux-xanmod-headers linux-xanmod + ) + remove_package() { + local package=$1 + # Check if the package is installed + if pacman -Q $package &> /dev/null; then + say_yellow "$package is installed. Removing..." + sudo pacman -Rns --noconfirm $package + else + say_yellow "$package is not installed." + fi + } + + # Loop over the array and remove each kernel package + for kernel in "${KERNELS_TO_REMOVE[@]}"; do + remove_package "$kernel" + done + +else + echo "Cannot proceed: At least one kernel must remain installed." +fi + +# Removing unwanted video drivers +remove_packages xf86-video-amdgpu xf86-video-ati xf86-video-fbdev xf86-video-nouveau xf86-video-openchrome xf86-video-vesa + +# Install essential tools +install_packages wget curl nano fastfetch lolcat bash-completion starship alacritty hwinfo lshw reflector expac betterlockscreen pamac-aur avahi man-db tree xdg-user-dirs rsync time bat unzip chromium +if [ ! -f /usr/bin/duf ]; then + install_packages duf +fi +install_packages man-db man-pages pacmanlogviewer paru-git yay-git thunar thunar-archive-plugin thunar-volman tree xdg-user-dirs polkit-gnome rate-mirrors rsync time bat ntp nss-mdns + +#disk-tools +install_packages baobab gvfs-smb hddtemp squashfs-tools + +#archive-managers +install_packages zip gzip p7zip unace unrar unzip file-roller peazip + +#theming +install_packages bibata-cursor-theme feh font-manager + +# All the software below will be installed on all desktops +install_packages archlinux-tools dconf-editor devtools hardinfo2 hw-probe logrotate lsb-release powertop inxi acpi plocate most namcap nm-connection-editor python-pylint python-pywal + +# Optionally handle fonts +FONT_DIR="$HOME/.local/share/fonts" +FONT_NAME="RobotoMonoNerdFont" # Changed name to reflect the installed files +FONT_ZIP="/tmp/RobotoMono.zip" # Use original ZIP name for download +DOWNLOAD_NAME="RobotoMono" +if ! compgen -G "$FONT_DIR/${FONT_NAME}*.ttf" > /dev/null; then + say_yellow "Installing ${DOWNLOAD_NAME} Nerd Font..." + mkdir -p "$FONT_DIR" + curl -L "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${DOWNLOAD_NAME}.zip" -o "$FONT_ZIP" + unzip -oq "$FONT_ZIP" -d "$FONT_DIR" + fc-cache -fv + rm "$FONT_ZIP" + say_green "${DOWNLOAD_NAME} installed." +else + say_yellow "${DOWNLOAD_NAME} Nerd Font is already installed in $FONT_DIR. Skipping installation." +fi + +# allow Chromium login with Google Account + # Define the configuration file path + CONF="$HOME/.config/chromium-flags.conf" + # Check if the file exists, or create it if it doesn't + if [[ ! -f "$CONF" ]]; then + # Create the file if it doesn't exist + touch "$CONF" + echo "Created new Chromium flags file: $CONF" + fi + # Add the OAuth 2.0 Client ID if it's not already there + # -q: quiet, -x: match whole line, -F: literal string match + grep -qxF -- "--oauth2-client-id=77185425430.apps.googleusercontent.com" "$CONF" || \ + echo "--oauth2-client-id=77185425430.apps.googleusercontent.com" >>"$CONF" + + # Add the OAuth 2.0 Client Secret if it's not already there + grep -qxF -- "--oauth2-client-secret=OTJgUOQcT7lO7GsGZq2G4IlT" "$CONF" || \ + echo "--oauth2-client-secret=OTJgUOQcT7lO7GsGZq2G4IlT" >>"$CONF" + + say_green "Chromium flags for Google Account login have been configured." + +# Enable basic services +#sudo systemctl enable chronyd.service +sudo systemctl enable fstrim.timer + +# End of script +say_green "Minimal setup completed." \ No newline at end of file diff --git a/v2/arch-niri.sh b/v2/arch-niri.sh new file mode 100755 index 0000000..1f2502b --- /dev/null +++ b/v2/arch-niri.sh @@ -0,0 +1,118 @@ +#!/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:-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 pacman -Sy; sudo pacman -S --noconfirm --needed "$@"; } +is_package_installed() { pacman -Qi "$@" &>/dev/null; } +remove_packages() { + local packages_to_remove=() + + # 1. Identify which packages are actually installed + for pkg in "$@"; do + if is_package_installed "$pkg"; then + packages_to_remove+=("$pkg") + else + say_gray "Package '$pkg' not found. Skipping removal." + fi + done + + # 2. Only run pacman if there are packages to remove + if [ ${#packages_to_remove[@]} -gt 0 ]; then + say_cyan "Removing packages: ${packages_to_remove[*]}" + sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true + else + say_gray "No packages to remove from the list." + fi +} + +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 +########################## +say_yellow "Starting Niri setup..." + +CURRENT_DE="$(detect_de)" +CURRENT_DM="$(detect_display_manager)" + +if [[ -z "$CURRENT_DE" ]]; then + say_cyan -e "No Desktop Environment detected. Installing Niri (light setup with SDDM)..." + + install_packages sddm niri noctalia-shell fuzzel swaybg xwayland-satellite swaylock + enable_graphical_target + + say_green -e "Niri with SDDM installed successfully. You can reboot now to start Niri." +else + say_cyan -e "Detected existing Desktop Environment: $CURRENT_DE" + + if [[ "$CURRENT_DM" == "lightdm" ]]; then + say_yellow -e "LightDM is currently active. Replacing with SDDM..." + + sudo systemctl disable lightdm + sudo apt purge -y lightdm lightdm-gtk-greeter + + install_packages sddm + enable_graphical_target + + say_green -e "LightDM removed and replaced with SDDM." + else + say_cyan -e "Current display manager: ${CURRENT_DM:-none}. Leaving unchanged." + fi +fi + +# End of script +say_green -e "Niri / SDDM setup completed." \ No newline at end of file diff --git a/v2/arch-plasma.sh b/v2/arch-plasma.sh new file mode 100755 index 0000000..a5899d3 --- /dev/null +++ b/v2/arch-plasma.sh @@ -0,0 +1,139 @@ +#!/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 "$@"; } +is_package_installed() { pacman -Qi "$@" &>/dev/null; } +remove_packages() { + local packages_to_remove=() + + # 1. Identify which packages are actually installed + for pkg in "$@"; do + if is_package_installed "$pkg"; then + packages_to_remove+=("$pkg") + else + say_gray "Package '$pkg' not found. Skipping removal." + fi + done + + # 2. Only run pacman if there are packages to remove + if [ ${#packages_to_remove[@]} -gt 0 ]; then + say_cyan "Removing packages: ${packages_to_remove[*]}" + sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true + else + say_gray "No packages to remove from the list." + fi +} + +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 + 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 gst-libav qt5-graphicaleffects qt5-quickcontrols qt5-quickcontrols2 + 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 + + +###### TODO +### from paru install pamac-tray-icon-plasma +### let autostart pamac-tray-plasma + + +# End of script +say_green -e "KDE Plasma / SDDM setup completed." + diff --git a/v2/arch-workstation.sh b/v2/arch-workstation.sh new file mode 100755 index 0000000..669260a --- /dev/null +++ b/v2/arch-workstation.sh @@ -0,0 +1,101 @@ +#!/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:-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 pacman -Sy; sudo pacman -S --noconfirm --needed "$@"; } +is_package_installed() { pacman -Qi "$@" &>/dev/null; } +remove_packages() { + local packages_to_remove=() + + # 1. Identify which packages are actually installed + for pkg in "$@"; do + if is_package_installed "$pkg"; then + packages_to_remove+=("$pkg") + else + say_gray "Package '$pkg' not found. Skipping removal." + fi + done + + # 2. Only run pacman if there are packages to remove + if [ ${#packages_to_remove[@]} -gt 0 ]; then + say_cyan "Removing packages: ${packages_to_remove[*]}" + sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true + else + say_gray "No packages to remove from the list." + fi +} + +say_yellow "Starting Workstation setup..." + +# Run full first +bash "$SCRIPT_DIR/arch-full.sh" + +# Add extra packages +install_packages git libreoffice-fresh +# gitahead-git + +# editors +install_packages vscodium sublime-text-4 konsole + +#internet +install_packages brave-bin insync +# google-chrome discord firefox + +#theming +# variety + +#media +install_packages flameshot-git mpv-full +# vlc gimp inkscape spotify lollypop + +#shells +install_packages zsh zsh-completions zsh-syntax-highlighting oh-my-zsh-git +# fish + +#system-tools +install_packages base-devel + +#tools +install_packages wttr system-config-printer ripgrep meld btop htop hwinfo lshw + +# End of script +say_green "Workstation setup completed." + +###### TODO +### autostart flameshot tray icon +### autostart insync tray icon diff --git a/v2/arch-xfce.sh b/v2/arch-xfce.sh new file mode 100755 index 0000000..fc5096d --- /dev/null +++ b/v2/arch-xfce.sh @@ -0,0 +1,133 @@ +#!/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 "$@"; } +is_package_installed() { pacman -Qi "$@" &>/dev/null; } +remove_packages() { + local packages_to_remove=() + + # 1. Identify which packages are actually installed + for pkg in "$@"; do + if is_package_installed "$pkg"; then + packages_to_remove+=("$pkg") + else + say_gray "Package '$pkg' not found. Skipping removal." + fi + done + + # 2. Only run pacman if there are packages to remove + if [ ${#packages_to_remove[@]} -gt 0 ]; then + say_cyan "Removing packages: ${packages_to_remove[*]}" + sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true + else + say_gray "No packages to remove from the list." + fi +} + +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 +########################## +say_yellow -e "Starting XFCE installation..." + +CURRENT_DE="$(detect_de)" +CURRENT_DM="$(detect_display_manager)" + +if [[ -z "$CURRENT_DE" || "$CURRENT_DE" != "xfce" ]]; then + say_cyan -e "XFCE4 not detected. Installing XFCE (light setup with SDDM)..." + + install_packages sddm xfce4 xfce4-goodies + enable_graphical_target + + say_green -e "XFCE 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 "XFCE / SDDM setup completed." + diff --git a/v2/arch.sh b/v2/arch.sh new file mode 100755 index 0000000..fc179be --- /dev/null +++ b/v2/arch.sh @@ -0,0 +1,191 @@ +#!/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)" + +echo +say_cyan "Starting Debian setup..." +echo +say_gray "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" + +########################## +# Helper functions +########################## +install_packages() { sudo pacman -S --noconfirm --needed "$@"; } +is_package_installed() { pacman -Qi "$@" &>/dev/null; } +remove_packages() { + local packages_to_remove=() + + # 1. Identify which packages are actually installed + for pkg in "$@"; do + if is_package_installed "$pkg"; then + packages_to_remove+=("$pkg") + else + say_gray "Package '$pkg' not found. Skipping removal." + fi + done + + # 2. Only run pacman if there are packages to remove + if [ ${#packages_to_remove[@]} -gt 0 ]; then + say_cyan "Removing packages: ${packages_to_remove[*]}" + sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true + else + say_gray "No packages to remove from the list." + fi +} + +########################## +# 0. Ensure base is ready for installation +########################## +installed_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +pkg_dir="packages" + +if [[ ! -d "$pkg_dir" ]]; then + say_red "Directory not found: $pkg_dir" + exit 1 +fi + +if ! command -v curl >/dev/null 2>&1; then + say_yellow "curl is not installed. Installing..." + sudo pacman -Sy + install_packages curl +fi + +# Install all local packages using pacman +find "$pkg_dir" -maxdepth 1 -name '*.pkg.tar.zst' -print0 | sudo xargs -0 pacman -U --noconfirm + +########################## +# 1. Add repositories if missing and update system +########################## +say_yellow "Checking pacman.conf and sources..." +sudo cp /etc/pacman.conf /etc/pacman.conf.bak.$(date +%s) +sudo cp -v "$installed_dir/config-files/pacman.conf" /etc/pacman.conf + +# Update the system +say_gray "Updating the system - sudo pacman -Syyu" +echo +sudo pacman -Syyu --noconfirm + +########################## +# 2. Fix missing console font +########################## +say_yellow "Fix missing console font" + +if grep -q FONT= /etc/vconsole.conf; then + say_green "Font is already set in /etc/vconsole.conf" +else + say_green "Setting console font in /etc/vconsole.conf" + echo 'FONT=gr737c-8x14' | sudo tee -a /etc/vconsole.conf +fi + +########################## +# 3. Detected OS / DE / TWM info +########################## +say_yellow "Detected OS / Desktop Environment / Tiling Window Manager" +echo +say_gray "Installing OS-specific packages..." +say_gray "Selected DE: $DE" +say_gray "Selected TWM: $TWM" +say_gray "Installation Level: $INSTALL_LEVEL" + +########################## +# 4. Desktop Environment installation +########################## +case "$DE" in + xfce|plasma|gnome) + say_yellow "Preparing to install $DE..." + SCRIPT_NAME="$SCRIPT_DIR/${OS}-${DE}.sh" + if [[ -f "$SCRIPT_NAME" ]]; then + say_cyan "Running $SCRIPT_NAME..." + bash "$SCRIPT_NAME" + else + say_red "Error: $SCRIPT_NAME not found!" + exit 1 + fi + ;; + none) + say_gray "No Desktop Environment selected, skipping DE installation." + ;; +esac + +########################## +# 5. Tiling Window Manager installation +########################## +case "$TWM" in + chadwm|hyprland) + say_yellow "Installing $TWM..." + SCRIPT_NAME="$SCRIPT_DIR/${OS}-${TWM}.sh" + if [[ -f "$SCRIPT_NAME" ]]; then + say_cyan "Running $SCRIPT_NAME..." + bash "$SCRIPT_NAME" + else + say_red "Error: $SCRIPT_NAME not found!" + exit 1 + fi + ;; + none) + say_gray "No tiling window manager selected." + ;; +esac + +########################## +# 6. Installation level handling +########################## +case "$INSTALL_LEVEL" in + minimal|full|workstation|server) + say_cyan "Installation level: $INSTALL_LEVEL" + SCRIPT_NAME="$SCRIPT_DIR/${OS}-${INSTALL_LEVEL}.sh" + if [[ -f "$SCRIPT_NAME" ]]; then + say_cyan "Running $SCRIPT_NAME..." + bash "$SCRIPT_NAME" + else + say_red "Error: $SCRIPT_NAME not found!" + exit 1 + fi + ;; +esac + +say_green "Arch setup complete." +say_red "The installation has finished. A reboot is recommended before continuing." +read -rp "Reboot now? [y/N]: " reboot_choice +case "${reboot_choice,,}" in + y|yes) + say_red "Rebooting now." + sudo reboot + ;; + *) + say_yellow "Skipping reboot. Make sure to reboot manually before continuing upgrades." + exit 0 + ;; +esac \ No newline at end of file diff --git a/v2/config-files/debian/.config/test.txt b/v2/config-files/debian/.config/test.txt new file mode 100644 index 0000000..6cda19a --- /dev/null +++ b/v2/config-files/debian/.config/test.txt @@ -0,0 +1 @@ +TEST-FILE \ No newline at end of file diff --git a/v2/config-files/debian/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml b/v2/config-files/debian/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml new file mode 100644 index 0000000..1bb5063 --- /dev/null +++ b/v2/config-files/debian/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/v2/config-files/pacman.conf b/v2/config-files/pacman.conf new file mode 100644 index 0000000..d9e6046 --- /dev/null +++ b/v2/config-files/pacman.conf @@ -0,0 +1,113 @@ +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives + +# +# GENERAL OPTIONS +# +[options] +# The following paths are commented out with their default values listed. +# If you wish to use different paths, uncomment and update the paths. +#RootDir = / +#DBPath = /var/lib/pacman/ +#CacheDir = /var/cache/pacman/pkg/ +#LogFile = /var/log/pacman.log +#GPGDir = /etc/pacman.d/gnupg/ +#HookDir = /etc/pacman.d/hooks/ +HoldPkg = pacman glibc +#XferCommand = /usr/bin/curl -L -C - -f -o %o %u +#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u +#CleanMethod = KeepInstalled +Architecture = auto + +# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup +#IgnorePkg = +#IgnoreGroup = + +#NoUpgrade = +#NoExtract = + +# Misc options +#UseSyslog +Color +#NoProgressBar +CheckSpace +VerbosePkgLists +ParallelDownloads = 25 +#DownloadUser = alpm +#DisableSandbox +ILoveCandy +DisableDownloadTimeout + +# By default, pacman accepts packages signed by keys that its local keyring +# trusts (see pacman-key and its man page), as well as unsigned packages. +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional +#RemoteFileSigLevel = Required + +# NOTE: You must run `pacman-key --init` before first using pacman; the local +# keyring can then be populated with the keys of all official Arch Linux +# packagers with `pacman-key --populate archlinux`. + +# +# REPOSITORIES +# - can be defined here or included from another file +# - pacman will search repositories in the order defined here +# - local/custom mirrors can be added here or in separate files +# - repositories listed first will take precedence when packages +# have identical names, regardless of version number +# - URLs will have $repo replaced by the name of the current repo +# - URLs will have $arch replaced by the name of the architecture +# +# Repository entries are of the format: +# [repo-name] +# Server = ServerName +# Include = IncludePath +# +# The header [repo-name] is crucial - it must be present and +# uncommented to enable the repo. +# + +# The testing repositories are disabled by default. To enable, uncomment the +# repo name header and Include lines. You can add preferred servers immediately +# after the header, and they will be used before the default mirrors. + +#[core-testing] +#Include = /etc/pacman.d/mirrorlist + +[core] +Include = /etc/pacman.d/mirrorlist + +#[extra-testing] +#Include = /etc/pacman.d/mirrorlist + +[extra] +Include = /etc/pacman.d/mirrorlist + +# If you want to run 32 bit applications on your x86_64 system, +# enable the multilib repositories as required here. + +#[multilib-testing] +#Include = /etc/pacman.d/mirrorlist + +[multilib] +Include = /etc/pacman.d/mirrorlist + +# An example of a custom package repository. See the pacman manpage for +# tips on creating your own repositories. +#[custom] +#SigLevel = Optional TrustAll +#Server = file:///home/custompkgs + +[yuku_repo] +SigLevel = Never +Server = https://yurikuit.github.io/$repo/$arch + +[nemesis_repo] +SigLevel = Never +Server = https://erikdubois.github.io/$repo/$arch + +[chaotic-aur] +SigLevel = Required DatabaseOptional +Include = /etc/pacman.d/chaotic-mirrorlist + diff --git a/v2/debian-chadwm.sh b/v2/debian-chadwm.sh new file mode 100755 index 0000000..218cd44 --- /dev/null +++ b/v2/debian-chadwm.sh @@ -0,0 +1,47 @@ +#!/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:-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)" + +echo +say_cyan "Starting Debian Chadwm setup..." +say_cyan "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" +echo + +# End of script +say_green "Chadwm setup completed." + +# Pause +read -n 1 -s -r -p "Press any key to continue" +echo diff --git a/v2/debian-full.sh b/v2/debian-full.sh new file mode 100755 index 0000000..4dcb7bd --- /dev/null +++ b/v2/debian-full.sh @@ -0,0 +1,202 @@ +#!/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:-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 pulseaudio pavucontrol playerctl gparted xfce4-indicator-plugin xfce4-pulseaudio-plugin xfce4-clipman-plugin + +# 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 + + # Set browser default + if command -v chromium >/dev/null 2>&1; then + mkdir -p "$HOME/.config/xfce4/" + HELPERS_FILE="$HOME/.config/xfce4/helpers.rc" + + # Ensure the helpers file exists + touch "$HELPERS_FILE" + + # Update or insert browser entry + if grep -q '^WebBrowser=' "$HELPERS_FILE"; then + sed -i 's|^WebBrowser=.*|WebBrowser=chromium|' "$HELPERS_FILE" + else + echo "WebBrowser=chromium" >> "$HELPERS_FILE" + fi + say_green "XFCE defeault browser set to chromium!" + fi + + # Set default terminal + if command -v alacritty >/dev/null 2>&1; then + mkdir -p "$HOME/.config/xfce4/" + HELPERS_FILE="$HOME/.config/xfce4/helpers.rc" + + touch "$HELPERS_FILE" + + # TerminalEmulator entry + if grep -q '^TerminalEmulator=' "$HELPERS_FILE"; then + sed -i 's|^TerminalEmulator=.*|TerminalEmulator=alacritty|' "$HELPERS_FILE" + else + echo "TerminalEmulator=alacritty" >> "$HELPERS_FILE" + fi + + # TerminalEmulatorCommand entry + if grep -q '^TerminalEmulatorCommand=' "$HELPERS_FILE"; then + sed -i 's|^TerminalEmulatorCommand=.*|TerminalEmulatorCommand=alacritty|' "$HELPERS_FILE" + else + echo "TerminalEmulatorCommand=alacritty" >> "$HELPERS_FILE" + fi + say_green "XFCE defeault terminal set to alacritty!" + fi +fi + +############################################### +# Copy settings to HOME +############################################### +SOURCE_DIR="$SCRIPT_DIR/config-files/debian" +DEST_DIR="$HOME" +AUTOSTART_DIR="$HOME/.config/autostart" +AUTOSTART_FILE="$AUTOSTART_DIR/xfce-config-apply.desktop" +HELPER_SCRIPT="$HOME/.local/bin/xfce-config-apply-helper.sh" + +mkdir -p "$AUTOSTART_DIR" "$HOME/.local/bin" + +# 1. Verify source directory exists +if [ ! -d "$SOURCE_DIR" ]; then + say_red "Error: Source directory '$SOURCE_DIR' not found. Aborting." + exit 1 +fi + +# 2. Create helper script +cat > "$HELPER_SCRIPT" <<'EOF' +#!/usr/bin/env bash +set -e + +RED="\033[0;31m"; GREEN="\033[0;32m"; YELLOW="\033[0;33m"; CYAN="\033[0;36m"; RESET="\033[0m" +say() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; } + +SOURCE_DIR="$HOME/config-files/debian" +DEST_DIR="$HOME" + +if [ ! -d "\$SOURCE_DIR" ]; then + say "Source directory \$SOURCE_DIR not found; skipping." + exit 0 +fi + +say "Applying XFCE configuration early in session..." +shopt -s dotglob +cp -vrf "\$SOURCE_DIR"/* "\$DEST_DIR"/ +shopt -u dotglob + +say "Clearing session cache..." +rm -rf "\$HOME/.cache/sessions/" + +say "Configuration applied. Removing one-time autostart entry..." +rm -f "\$HOME/.config/autostart/xfce-config-apply.desktop" +exit 0 +EOF + +chmod +x "$HELPER_SCRIPT" + +# 3. Create autostart entry (early-phase) +cat > "$AUTOSTART_FILE" </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; } + +say_yellow "Starting Gnome installation..." + +CURRENT_DE="$(detect_de)" +CURRENT_DM="$(detect_display_manager)" + +if [[ -z "$CURRENT_DE" ]]; then + say_cyan "No DE detected. Installing Gnome with SDDM..." + 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 + say_green "Gnome with SDDM installed successfully." +else + say_cyan "Detected existing DE: $CURRENT_DE" + if [[ "$CURRENT_DM" == "lightdm" ]]; then + say_yellow "Replacing LightDM with SDDM..." + sudo systemctl disable lightdm + sudo apt purge -y lightdm lightdm-gtk-greeter + install_packages sddm + enable_graphical_target + say_green "LightDM replaced with SDDM." + else + say_cyan "Current DM: ${CURRENT_DM:-none}, leaving unchanged." + fi +fi diff --git a/v2/debian-hyprland.sh b/v2/debian-hyprland.sh new file mode 100755 index 0000000..8f4fa02 --- /dev/null +++ b/v2/debian-hyprland.sh @@ -0,0 +1,53 @@ +#!/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:-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 hyprland setup..." + +# Optionally add hyprland-specific packages here +#install_packages ???? + +# End of script +say_green "hyprland setup completed." + +# Pause +read -n 1 -s -r -p "Press any key to continue" +echo diff --git a/v2/debian-minimal.sh b/v2/debian-minimal.sh new file mode 100755 index 0000000..8cdf047 --- /dev/null +++ b/v2/debian-minimal.sh @@ -0,0 +1,73 @@ +#!/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:-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 minimal setup..." + +# 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} + +# 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 unzip chromium + +# Optionally handle fonts +FONT_DIR="$HOME/.local/share/fonts" +FONT_NAME="RobotoMonoNerdFont" # Changed name to reflect the installed files +FONT_ZIP="/tmp/RobotoMono.zip" # Use original ZIP name for download +DOWNLOAD_NAME="RobotoMono" +if ! find "$FONT_DIR" -name "${FONT_NAME}*.ttf" -print -quit 2>/dev/null; then + say_yellow "Installing ${DOWNLOAD_NAME} Nerd Font..." + mkdir -p "$FONT_DIR" + curl -L "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${DOWNLOAD_NAME}.zip" -o "$FONT_ZIP" + unzip -oq "$FONT_ZIP" -d "$FONT_DIR" + fc-cache -fv + rm "$FONT_ZIP" + say_green "${DOWNLOAD_NAME} installed." +else + say_yellow "${DOWNLOAD_NAME} Nerd Font is already installed in $FONT_DIR. Skipping installation." +fi + +# Enable basic services +sudo systemctl enable chrony +sudo systemctl enable fstrim.timer + +# End of script +say_green "Minimal setup completed." \ No newline at end of file diff --git a/v2/debian-plasma.sh b/v2/debian-plasma.sh new file mode 100755 index 0000000..7d60ad4 --- /dev/null +++ b/v2/debian-plasma.sh @@ -0,0 +1,75 @@ +#!/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:-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; } +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; } + +########################## +# Install Plasma +########################## +say_yellow "Starting KDE Plasma installation..." + +CURRENT_DE="$(detect_de)" +CURRENT_DM="$(detect_display_manager)" + +if [[ -z "$CURRENT_DE" ]]; then + say_cyan "No DE detected. Installing KDE Plasma with SDDM..." + 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 + say_green "KDE Plasma with SDDM installed successfully." +else + say_cyan "Detected existing DE: $CURRENT_DE" + if [[ "$CURRENT_DM" == "lightdm" ]]; then + colosay_yellow "Replacing LightDM with SDDM..." + sudo systemctl disable lightdm + sudo apt purge -y lightdm lightdm-gtk-greeter + install_packages sddm + enable_graphical_target + say_green "LightDM replaced with SDDM." + else + say_cyan "Current DM: ${CURRENT_DM:-none}, leaving unchanged." + fi +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-server.sh b/v2/debian-server.sh new file mode 100755 index 0000000..ba394d4 --- /dev/null +++ b/v2/debian-server.sh @@ -0,0 +1,53 @@ +#!/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:-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 Server setup..." + +# Optionally add Server-specific packages here +install_packages linux-headers-$(uname -r) + +# End of script +say_green "Server setup completed." + +# Pause +read -n 1 -s -r -p "Press any key to continue" +echo diff --git a/v2/debian-workstation.sh b/v2/debian-workstation.sh new file mode 100755 index 0000000..65735c7 --- /dev/null +++ b/v2/debian-workstation.sh @@ -0,0 +1,56 @@ +#!/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:-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 workstation setup..." + +# Run full setup first +bash "$SCRIPT_DIR/debian-full.sh" + +# Optionally add workstation-specific packages here +install_packages git vlc libreoffice + +# End of script +say_green "Workstation setup completed." + +# Pause +read -n 1 -s -r -p "Press any key to continue" +echo diff --git a/v2/debian-xfce.sh b/v2/debian-xfce.sh new file mode 100755 index 0000000..5713917 --- /dev/null +++ b/v2/debian-xfce.sh @@ -0,0 +1,105 @@ +#!/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() { + 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 +########################## +say_yellow -e "Starting XFCE installation..." + +CURRENT_DE="$(detect_de)" +CURRENT_DM="$(detect_display_manager)" + +if [[ -z "$CURRENT_DE" ]]; then + say_cyan -e "No Desktop Environment detected. Installing XFCE (light setup with SDDM)..." + + install_packages sddm xfce4 xfce4-goodies + enable_graphical_target + + say_green -e "XFCE with SDDM installed successfully. You can reboot now to start XFCE." +else + say_cyan -e "Detected existing Desktop Environment: $CURRENT_DE" + + if [[ "$CURRENT_DM" == "lightdm" ]]; then + say_yellow -e "LightDM is currently active. Replacing with SDDM..." + + sudo systemctl disable lightdm + sudo pacman -Rns lightdm lightdm-gtk-greeter + + install_packages sddm + enable_graphical_target + + say_green -e "LightDM removed and replaced with SDDM." + else + say_cyan -e "Current display manager: ${CURRENT_DM:-none}. Leaving unchanged." + fi +fi + +# End of script +say_green -e "XFCE / SDDM setup completed." diff --git a/v2/debian.sh b/v2/debian.sh new file mode 100755 index 0000000..8d335b5 --- /dev/null +++ b/v2/debian.sh @@ -0,0 +1,242 @@ +#!/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)" + +echo +say_cyan "Starting Debian setup..." +echo +say_gray "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" + +########################## +# 0. Ensure curl is installed +########################## +if ! command -v curl >/dev/null 2>&1; then + say_yellow "curl is not installed. Installing..." + sudo apt update + sudo apt -y install curl +fi + +########################## +# 1. Add contrib and non-free if missing +########################## +say_yellow "Checking /etc/apt/sources.list for contrib/non-free..." +sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak.$(date +%s) +sudo sed -i -r 's/^(deb\s+\S+\s+\S+)\s+(main)$/\1 main contrib non-free/' /etc/apt/sources.list +say_green "Updated sources.list to include contrib/non-free where needed." + +########################## +# 1a. Update archive.debian.org if needed +########################## +CURRENT_CODENAME=$(grep -Po 'deb\s+\S+\s+\K\S+' /etc/apt/sources.list | grep -E '^(buster|bullseye|bookworm|trixie)$' | head -n1) +DEBIAN_ORDER=(buster bullseye bookworm trixie) + +codename_index() { + local code="$1" + for i in "${!DEBIAN_ORDER[@]}"; do + [[ "${DEBIAN_ORDER[$i]}" == "$code" ]] && echo "$i" && return + done + echo -1 +} + +CURRENT_INDEX=$(codename_index "$CURRENT_CODENAME") +BULLSEYE_INDEX=$(codename_index "bullseye") + +if [[ "$CURRENT_INDEX" -ge "$BULLSEYE_INDEX" ]] && grep -q "archive.debian.org" /etc/apt/sources.list; then + say_yellow "Found archive.debian.org in sources.list and system is Bullseye or newer, updating to deb.debian.org..." + sudo sed -i -r 's|archive\.debian\.org|deb.debian.org|g' /etc/apt/sources.list + say_green "Updated sources.list to use deb.debian.org." +fi + +########################## +# 2. Full update and upgrade +########################## +say_yellow "Updating package lists..." +sudo apt update + +AUTOREMOVE_PENDING=$(apt -s autoremove | grep -E 'Remv' || true) +if [[ -n "$AUTOREMOVE_PENDING" ]]; then + say_yellow "Removing packages that are no longer required before upgrade..." + sudo apt -y autoremove +fi + +say_yellow "Upgrading installed packages..." +sudo apt -y full-upgrade + +AUTOREMOVE_PENDING=$(apt -s autoremove | grep -E 'Remv' || true) +if [[ -n "$AUTOREMOVE_PENDING" ]]; then + say_yellow "Removing packages that are no longer required after upgrade..." + sudo apt -y autoremove +fi + +UPGRADE_PENDING=$(apt list --upgradable 2>/dev/null | grep -v Listing || true) +if [[ -n "$UPGRADE_PENDING" ]]; then + say_red "Some packages were upgraded. A reboot is recommended before continuing." + read -rp "Reboot now? [y/N]: " reboot_choice + case "${reboot_choice,,}" in + y|yes) + say_red "Rebooting now. After reboot, please restart this script to continue..." + sudo reboot + ;; + *) + say_yellow "Skipping reboot. Make sure to reboot manually before continuing upgrades." + exit 0 + ;; + esac +else + say_green "All packages are up to date. Continuing to Debian major version check..." +fi + +########################## +# 3. Stepwise major version upgrade +########################## +DEBIAN_SEQUENCE=(buster bullseye bookworm trixie) +CURRENT_CODENAME=$(grep -Po 'deb\s+\S+\s+\K\S+' /etc/apt/sources.list | grep -E '^(buster|bullseye|bookworm|trixie)$' | head -n1) +LATEST_CODENAME=${DEBIAN_SEQUENCE[-1]} + +say_cyan "Current codename: $CURRENT_CODENAME" +say_cyan "Latest stable codename: $LATEST_CODENAME" + +while [[ "$CURRENT_CODENAME" != "$LATEST_CODENAME" ]]; do + NEXT_CODENAME="" + for i in "${!DEBIAN_SEQUENCE[@]}"; do + if [[ "${DEBIAN_SEQUENCE[$i]}" == "$CURRENT_CODENAME" ]]; then + NEXT_CODENAME="${DEBIAN_SEQUENCE[$((i+1))]}" + break + fi + done + + if [[ -z "$NEXT_CODENAME" ]]; then + say_red "Error: Cannot determine next codename after $CURRENT_CODENAME" + exit 1 + fi + + say_yellow "Detected codename $CURRENT_CODENAME, next stable version: $NEXT_CODENAME" + read -rp "Do you want to upgrade to $NEXT_CODENAME? [y/N]: " choice + case "${choice,,}" in + y|yes) + say_yellow "Updating sources.list to $NEXT_CODENAME..." + sudo sed -i -r "s/\b$CURRENT_CODENAME\b/$NEXT_CODENAME/g" /etc/apt/sources.list + + say_yellow "Updating packages..." + sudo apt update + sudo apt -y autoremove || true + sudo apt -y full-upgrade + sudo apt -y autoremove || true + + say_green "Upgrade to $NEXT_CODENAME complete. A reboot is recommended." + read -rp "Press Enter to reboot..." _ + sudo reboot + ;; + *) + say_yellow "Skipping upgrade to $NEXT_CODENAME. Continuing with current version." + break + ;; + esac + + CURRENT_CODENAME=$(grep -Po 'deb\s+\S+\s+\K\S+' /etc/apt/sources.list | grep -E '^(buster|bullseye|bookworm|trixie)$' | head -n1) +done + +say_green "Debian is now at codename $CURRENT_CODENAME. Continuing with DE/TWM installation..." + +########################## +# 4. Desktop Environment installation +########################## +case "$DE" in + xfce|plasma|gnome) + say_yellow "Preparing to install $DE..." + SCRIPT_NAME="$SCRIPT_DIR/${OS}-${DE}.sh" + if [[ -f "$SCRIPT_NAME" ]]; then + say_cyan "Running $SCRIPT_NAME..." + bash "$SCRIPT_NAME" + else + say_red "Error: $SCRIPT_NAME not found!" + exit 1 + fi + ;; + none) + say_gray "No Desktop Environment selected, skipping DE installation." + ;; +esac + +########################## +# 5. Tiling Window Manager installation +########################## +case "$TWM" in + chadwm|hyprland) + say_yellow "Installing $TWM..." + SCRIPT_NAME="$SCRIPT_DIR/${OS}-${TWM}.sh" + if [[ -f "$SCRIPT_NAME" ]]; then + say_cyan "Running $SCRIPT_NAME..." + bash "$SCRIPT_NAME" + else + say_red "Error: $SCRIPT_NAME not found!" + exit 1 + fi + ;; + none) + say_gray "No tiling window manager selected." + ;; +esac + +########################## +# 6. Installation level handling +########################## +case "$INSTALL_LEVEL" in + minimal|full|workstation|server) + say_cyan "Installation level: $INSTALL_LEVEL" + SCRIPT_NAME="$SCRIPT_DIR/${OS}-${INSTALL_LEVEL}.sh" + if [[ -f "$SCRIPT_NAME" ]]; then + say_cyan "Running $SCRIPT_NAME..." + bash "$SCRIPT_NAME" + else + say_red "Error: $SCRIPT_NAME not found!" + exit 1 + fi + ;; +esac + +say_green "Debian setup complete." +say_red "The installation has finished. A reboot is recommended before continuing." +read -rp "Reboot now? [y/N]: " reboot_choice +case "${reboot_choice,,}" in + y|yes) + say_red "Rebooting now." + sudo reboot + ;; + *) + say_yellow "Skipping reboot. Make sure to reboot manually before continuing upgrades." + exit 0 + ;; +esac diff --git a/v2/fedora.sh b/v2/fedora.sh new file mode 100755 index 0000000..be50691 --- /dev/null +++ b/v2/fedora.sh @@ -0,0 +1,114 @@ +#!/bin/bash +set -euo pipefail + +########################## +# Color helpers +########################## +tput_reset() { tput sgr0; } +tput_black() { tput setaf 0; } +tput_red() { tput setaf 1; } +tput_green() { tput setaf 2; } +tput_yellow() { tput setaf 3; } +tput_blue() { tput setaf 4; } +tput_purple() { tput setaf 5; } +tput_cyan() { tput setaf 6; } +tput_gray() { tput setaf 7; } + +echo +tput_yellow +echo "################################################################################" +echo "################### Detected OS / Desktop Environmet / Tiling Window Manager" +echo "################################################################################" +tput_reset +echo + +echo "Installing OS-specific packages..." +echo "Selected DE: $SELECTED_DE" +echo "Selected TWM: $SELECTED_TWM" +echo "Installation Level: $INSTALL_LEVEL" + +if [[ "$SELECTED_DE" == "xfce" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing XFCE4" + echo "################################################################################" + tput_reset + echo + + echo "Installing XFCE packages..." + +fi + +if [[ "$SELECTED_DE" == "plasma" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing KDE Plasma 6" + echo "################################################################################" + tput_reset + echo + + echo "Installing Plasma packages..." +fi + +if [[ "$SELECTED_DE" == "gnome" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing Gnome 48" + echo "################################################################################" + tput_reset + echo + + echo "Installing Gnome packages..." +fi + +if [[ "$SELECTED_DE" == "none" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing no Desktop Environment" + echo "################################################################################" + tput_reset + echo + + echo "Installing no Desktop Environment packages..." +fi + + +if [[ "$SELECTED_TWM" == "chadwm" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing Chadwm" + echo "################################################################################" + tput_reset + echo + + echo "Installing CHADWM..." +fi + +if [[ "$SELECTED_TWM" == "hyprland" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing Hyprland" + echo "################################################################################" + tput_reset + echo + + echo "Installing Hyperland..." +fi + +if [[ "$SELECTED_TWM" == "none" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing no Tiling Window Manager" + echo "################################################################################" + tput_reset + echo + + echo "Installing no Tiling Window Manager packages..." +fi diff --git a/v2/ubuntu.sh b/v2/ubuntu.sh new file mode 100755 index 0000000..be50691 --- /dev/null +++ b/v2/ubuntu.sh @@ -0,0 +1,114 @@ +#!/bin/bash +set -euo pipefail + +########################## +# Color helpers +########################## +tput_reset() { tput sgr0; } +tput_black() { tput setaf 0; } +tput_red() { tput setaf 1; } +tput_green() { tput setaf 2; } +tput_yellow() { tput setaf 3; } +tput_blue() { tput setaf 4; } +tput_purple() { tput setaf 5; } +tput_cyan() { tput setaf 6; } +tput_gray() { tput setaf 7; } + +echo +tput_yellow +echo "################################################################################" +echo "################### Detected OS / Desktop Environmet / Tiling Window Manager" +echo "################################################################################" +tput_reset +echo + +echo "Installing OS-specific packages..." +echo "Selected DE: $SELECTED_DE" +echo "Selected TWM: $SELECTED_TWM" +echo "Installation Level: $INSTALL_LEVEL" + +if [[ "$SELECTED_DE" == "xfce" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing XFCE4" + echo "################################################################################" + tput_reset + echo + + echo "Installing XFCE packages..." + +fi + +if [[ "$SELECTED_DE" == "plasma" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing KDE Plasma 6" + echo "################################################################################" + tput_reset + echo + + echo "Installing Plasma packages..." +fi + +if [[ "$SELECTED_DE" == "gnome" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing Gnome 48" + echo "################################################################################" + tput_reset + echo + + echo "Installing Gnome packages..." +fi + +if [[ "$SELECTED_DE" == "none" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing no Desktop Environment" + echo "################################################################################" + tput_reset + echo + + echo "Installing no Desktop Environment packages..." +fi + + +if [[ "$SELECTED_TWM" == "chadwm" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing Chadwm" + echo "################################################################################" + tput_reset + echo + + echo "Installing CHADWM..." +fi + +if [[ "$SELECTED_TWM" == "hyprland" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing Hyprland" + echo "################################################################################" + tput_reset + echo + + echo "Installing Hyperland..." +fi + +if [[ "$SELECTED_TWM" == "none" ]]; then + echo + tput_green + echo "################################################################################" + echo "################### Installing no Tiling Window Manager" + echo "################################################################################" + tput_reset + echo + + echo "Installing no Tiling Window Manager packages..." +fi