CLEANUP v1

This commit is contained in:
[yuri]
2025-11-10 09:37:46 +01:00
commit 281fb06382
46 changed files with 5559 additions and 0 deletions

247
v2/0-setup-linux.sh Executable file
View File

@@ -0,0 +1,247 @@
#!/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 "################### Start OS Detection"
echo "################################################################"
tput_reset
echo
##########################
# OS Detection
##########################
source /etc/os-release
OS_ID="${ID,,}"
OS_LIKE="${ID_LIKE:-}"
OS_LIKE="${OS_LIKE,,}"
OS_VERSION="$VERSION_ID"
OS_PRETTY="$PRETTY_NAME"
OS=""
case "$OS_ID" in
arch) OS="arch" ;;
debian) OS="debian" ;;
ubuntu) OS="ubuntu" ;;
fedora) OS="fedora" ;;
*)
# fallback for derivatives
if [[ "$OS_LIKE" == *"ubuntu"* ]]; then
OS="ubuntu"
elif [[ "$OS_LIKE" == *"arch"* ]]; then
OS="arch"
elif [[ "$OS_LIKE" == *"debian"* ]]; then
OS="debian"
elif [[ "$OS_LIKE" == *"fedora"* || "$OS_LIKE" == *"rhel"* ]]; then
OS="fedora"
fi
;;
esac
if [[ -n "$OS" ]]; then
tput_cyan
echo "################################################################################"
echo "Detected OS: $OS ($OS_PRETTY)"
echo "Version: $OS_VERSION"
echo "################################################################################"
tput_reset
else
tput_red
echo "################################################################################"
echo "ERROR: Unsupported or unknown Linux distribution."
echo "Detected: ID=$OS_ID, ID_LIKE=${OS_LIKE:-empty}"
echo "################################################################################"
tput_reset
exit 1
fi
##########################
# Desktop Environment Detection / Selection
##########################
echo
tput_yellow
echo "################################################################"
echo "################### Desktop Environment Selection"
echo "################################################################"
tput_reset
echo
DE_RAW="${XDG_CURRENT_DESKTOP:-${DESKTOP_SESSION:-}}"
DE=""
case "${DE_RAW,,}" in
*xfce*) DE="xfce" ;;
*plasma*|*kde*) DE="plasma" ;;
*gnome*) DE="gnome" ;;
""|none) DE="" ;; # trigger menu
esac
if [[ -n "$DE" ]]; then
echo
tput_cyan
echo "################################################################################"
echo "Detected Desktop Environment: $DE (${DE_RAW})"
echo "################################################################################"
tput_reset
else
# No DE detected — ask user
echo
echo "No Desktop Environment detected. Select one to install:"
while true; do
echo " 1) XFCE"
echo " 2) Plasma"
echo " 3) GNOME"
echo " x) None (default)"
read -rp "Enter choice [1/2/3/x] (default: x): " choice
case "${choice,,}" in
1) DE="xfce"; break ;;
2) DE="plasma"; break ;;
3) DE="gnome"; break ;;
x|"") DE="none"; break ;;
*) echo "Invalid option. Please enter 1, 2, 3, or x." ;;
esac
done
echo
tput_cyan
echo "################################################################################"
echo "Selected Desktop Environment: $DE"
echo "################################################################################"
tput_reset
fi
##########################
# Tiling Window Manager Selection
##########################
echo
tput_yellow
echo "################################################################"
echo "################### Tiling WM Selection"
echo "################################################################"
tput_reset
echo
TWM="none"
while true; do
echo
echo "Select a tiling window manager:"
echo " 1) CHADWM"
echo " 2) Hyprland"
echo " x) None (default)"
read -rp "Enter choice [1/2/x] (default: x): " choice
case "${choice,,}" in
1) TWM="chadwm"; break ;;
2) TWM="hyprland"; break ;;
x|"") TWM="none"; break ;;
*) echo "Invalid option. Please enter 1, 2, or x." ;;
esac
done
echo
tput_cyan
echo "################################################################################"
echo "Selected Tiling WM: $TWM"
echo "################################################################################"
tput_reset
##########################
# Installation Level Selection
##########################
echo
tput_yellow
echo "################################################################"
echo "################### Installation Level Selection"
echo "################################################################"
tput_reset
echo
INSTALL_LEVEL="minimal" # default
while true; do
echo
echo "Select installation level:"
echo " 1) minimal"
echo " 2) full"
echo " 3) workstation"
echo " 4) server"
read -rp "Enter choice [1/2/3/4] (default: 1): " choice
case "$choice" in
1|"") INSTALL_LEVEL="minimal"; break ;;
2) INSTALL_LEVEL="full"; break ;;
3) INSTALL_LEVEL="workstation"; break ;;
4) INSTALL_LEVEL="server"; break ;;
*) echo "Invalid option. Please enter 1, 2, 3, or 4." ;;
esac
done
echo
tput_cyan
echo "################################################################################"
echo "Selected Installation Level: $INSTALL_LEVEL"
echo "################################################################################"
tput_reset
##########################
# Export selections for OS script
##########################
export DETECTED_OS="$OS"
export DETECTED_DE="$DE_RAW"
export SELECTED_DE="$DE"
export SELECTED_TWM="$TWM"
export INSTALL_LEVEL
##########################
# Determine OS script
##########################
case "$OS" in
debian) OS_SCRIPT="./debian.sh" ;;
ubuntu) OS_SCRIPT="./ubuntu.sh" ;;
arch) OS_SCRIPT="./arch.sh" ;;
fedora) OS_SCRIPT="./fedora.sh" ;;
*)
tput_red
echo
echo "No OS script available for $OS"
tput_reset
exit 1
;;
esac
##########################
# Preflight check
##########################
if [[ ! -x "$OS_SCRIPT" ]]; then
tput_red
echo
echo "ERROR: OS script not found or not executable: $OS_SCRIPT"
tput_reset
exit 1
fi
##########################
# Run OS script
##########################
echo
echo "Running OS script: $OS_SCRIPT"
"$OS_SCRIPT"
echo
tput_yellow
echo "################################################################"
echo "End Detection"
echo "################################################################"
tput_reset

255
v2/arch.sh Executable file
View File

@@ -0,0 +1,255 @@
#!/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; }
##########################
# 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}"
tput_cyan
echo
echo "Starting Arch Linux setup..."
tput_reset
echo
echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
##########################
# 0. Ensure base is ready for installation
##########################
# Setting installed_dir to base folder of the git-repository
installed_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Installing chaotic-aur keys and mirrors
pkg_dir="packages"
# Ensure directory exists
if [[ ! -d "$pkg_dir" ]]; then
echo "Directory not found: $pkg_dir"
exit 1
fi
if ! command -v curl >/dev/null 2>&1; then
tput_yellow
echo
echo "curl is not installed. Installing..."
tput_reset
sudo pacman -Sy
sudo sudo pacman -S --noconfirm --needed 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 repsotirories if missing
##########################
tput_yellow
echo
echo "Checking /etc/apt/sources.list for contrib/non-free..."
tput_reset
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
tput_green
echo
echo "Updated sources.list to include contrib/non-free where needed."
tput_reset
# personal pacman.conf
if [[ ! -f /etc/pacman.conf.starburst ]]; then
echo
tput setaf 2
echo "################################################################################"
echo "Copying /etc/pacman.conf to /etc/pacman.conf.starburst"
echo "################################################################################"
tput sgr0
echo
sudo cp -v /etc/pacman.conf /etc/pacman.conf.starburst
echo
else
echo
tput setaf 2
echo "################################################################################"
echo "Backup already exists: /etc/pacman.conf.starburst"
echo "################################################################################"
tput sgr0
echo
fi
sudo cp -v $installed_dir/config-files/pacman.conf /etc/pacman.conf
# update the system
echo
tput setaf 2
echo "################################################################################"
echo "Updating the system - sudo pacman -Syyu"
echo "################################################################################"
tput sgr0
echo
sudo pacman -Syyu --noconfirm
# fix missing console font
echo
tput setaf 3
echo "################################################################"
echo "################### fix missing console font"
echo "################################################################"
tput sgr0
echo
if grep -q FONT= /etc/vconsole.conf; then
echo
tput setaf 2
echo "################################################################"
echo "################### FONT is already set in /etc/vconsole.conf"
echo "################################################################"
tput sgr0
echo
else
tput setaf 2
echo "################################################################"
echo "################### FONT added to /etc/vconsole.conf"
echo "################################################################"
tput sgr0
echo 'FONT=gr737c-8x14' | sudo tee -a /etc/vconsole.conf
fi
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

27
v2/debian-chadwm.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/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_cyan() { tput setaf 4; }
tput_purple() { tput setaf 5; }
tput_cyan() { tput setaf 6; }
tput_gray() { tput setaf 7; }
##########################
# 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}"
# Pause
read -n 1 -s -r -p "Press any key to continue"

47
v2/debian-full.sh Executable file
View File

@@ -0,0 +1,47 @@
#!/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_cyan() { tput setaf 4; }
tput_purple() { tput setaf 5; }
tput_cyan() { tput setaf 6; }
tput_gray() { tput setaf 7; }
##########################
# 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}"
# Pause
read -n 1 -s -r -p "Press any key to continue"
# Before running FULL first run Minimal
bash debian-minimal.sh
# Now continue with FULL
# install tools
sudo apt install -y \
arandr \
catfish \
galculator \
network-manager \
network-manager-applet \
network-manager-openvpn \
numlockx \
pavucontrol \
playerctl \
xcolors \
gparted

135
v2/debian-gnome.sh Executable file
View File

@@ -0,0 +1,135 @@
#!/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; }
##########################
# 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}"
##########################
# 4. Desktop Environment installation
##########################
tput_yellow
echo "Installing Gnome..."
tput_reset
#detect if Gnome and SDDM are installed and if not install them
if [[ -z "$DDE" ]]; then
tput_cyan
echo
echo "No Desktop Environment detected. Installing Gnome (light setup with SDDM)..."
tput_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
# Enable SDDM as the display manager
sudo systemctl enable sddm
# Enable graphical target
sudo systemctl set-default graphical.target
tput_green
echo
echo "Gnome with SDDM installed successfully."
echo "You can reboot now to start Gnome."
tput_reset
else
tput_cyan
echo
echo "You already have $DE installed."
tput_reset
# Check if LightDM is installed and active
if systemctl is-active --quiet lightdm; then
tput_yellow
echo
echo "LightDM is currently active. Replacing with SDDM..."
tput_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
# Enable graphical target
sudo systemctl set-default graphical.target
tput_green
echo
echo "LightDM removed and replaced with SDDM."
tput_reset
else
tput_cyan
echo
echo "No LightDM detected, leaving current display manager unchanged."
tput_reset
fi
fi
#cleanup unwanted packages
# Packages to remove
#packages=("vim" "vim-runtime" "vim-common" "vim-tiny" "mousepad" "parole")
#sudo apt-mark manual xfce4-goodies
# Function to check if a package is installed
is_package_installed() {
dpkg -s "$1" &> /dev/null
}
# Iterate over each package
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
# Resolving network issues
sudo mv /etc/network/interfaces /etc/network/interfaces.bak
sudo systemctl restart NetworkManager
# Remove leftover dependencies
sudo apt-get autoremove -y

27
v2/debian-hyprland.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/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_cyan() { tput setaf 4; }
tput_purple() { tput setaf 5; }
tput_cyan() { tput setaf 6; }
tput_gray() { tput setaf 7; }
##########################
# 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}"
# Pause
read -n 1 -s -r -p "Press any key to continue"

298
v2/debian-minimal.sh Executable file
View File

@@ -0,0 +1,298 @@
#!/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_cyan() { tput setaf 4; }
tput_purple() { tput setaf 5; }
tput_cyan() { tput setaf 6; }
tput_gray() { tput setaf 7; }
##########################
# 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}"
# Pause
read -n 1 -s -r -p "Press any key to continue"
# on all DE
#################################################################
# Create directories (skel + user)
#################################################################
echo
tput setaf 2
echo "########################################################################"
echo "################### Creating directories"
echo "########################################################################"
tput sgr0
echo
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}
# Packages to remove
packages=("vim" "vim-runtime" "vim-common" "vim-tiny" "mousepad" "parole")
# Function to check if a package is installed
is_package_installed() {
dpkg -s "$1" &> /dev/null
}
# Iterate over each package
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
# Remove leftover dependencies
sudo apt-get autoremove -y
# install needed packages
#firmwares
sudo apt-get install -y \
dkms \
linux-headers-$(uname -r)
#archive-managers
sudo apt install -y zip gzip p7zip unace unrar unzip
#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
# Install RobotoMono Nerd Font
# Destination directory
FONT_DIR="$HOME/.local/share/fonts"
mkdir -p "$FONT_DIR"
# Download RobotoMono Nerd Font (latest release)
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"
echo "Cleaning up..."
rm -rf "$TMP_DIR"
echo "Updating font cache..."
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
if [ ! -f /usr/bin/duf ]; then
sudo apt install -y duf
fi
sudo apt install -y \
man-db \
manpages \
tree \
xdg-user-dirs \
mate-polkit \
rsync \
time \
bat \
chrony
#theming
sudo apt install -y \
bibata-cursor-theme \
feh \
arc-theme
echo "Installing Surfn icon theme..."
# Clone Surfn repo
TEMP_DIR=$(mktemp -d)
git clone https://github.com/erikdubois/Surfn.git "$TEMP_DIR/surfn"
cd "$TEMP_DIR/surfn"
# Copy the icon theme to the user's local icons directory
cp -r surfn-icons/* ~/.icons/
cd ~
rm -rf "$TEMP_DIR"
echo "Surfn icon theme installed."
echo "Installing Flat Remix Dark GTK theme..."
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
# Download latest master as tar.gz
wget -O flat-remix-gtk.tar.gz https://github.com/daniruiz/flat-remix-gtk/archive/refs/heads/master.tar.gz
# Extract
tar -xzf flat-remix-gtk.tar.gz
# Move the Dark GTK theme to ~/.themes
# The actual theme folder is "Flat-Remix-Dark" inside the extracted directory
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
sudo systemctl enable chrony
#Run service that will discard unused blocks on mounted filesystems. This is useful for solid-state drives (SSDs) and thinly-provisioned storage.
echo
echo "Enable fstrim timer"
sudo systemctl enable fstrim.timer
echo
tput setaf 3
echo "########################################################################"
echo "Detecting virtualization platform..."
echo "########################################################################"
tput sgr0
echo
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
# if on XFCE
case "$DE" in
xfce)
#################################################################
# Create directories (skel + user)
#################################################################
echo
tput setaf 2
echo "########################################################################"
echo "################### Creating directories"
echo "########################################################################"
tput sgr0
echo
sudo mkdir -p /etc/skel/.config/xfce4/{panel,xfconf}
mkdir -p \
"$HOME/.config/"{xfce4,xfce4/xfconf}
# cleanup unwanted packages
tput_yellow
echo
echo "Removing unwanted packages from $DE..."
tput_reset
# Packages to remove
packages=("xfburn" "xfce4-screenshooter" "xfce4-notes")
sudo apt-mark manual xfce4-goodies
# Function to check if a package is installed
is_package_installed() {
dpkg -s "$1" &> /dev/null
}
# Iterate over each package
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
# Remove leftover dependencies
sudo apt-get autoremove -y
# install needed packages
#tools
sudo apt install -y thunar thunar-archive-plugin thunar-volman
#archive-managers
sudo apt install -y file-roller
;;
esac

142
v2/debian-plasma.sh Executable file
View File

@@ -0,0 +1,142 @@
#!/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; }
##########################
# 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}"
##########################
# 4. Desktop Environment installation
##########################
tput_yellow
echo "Installing KDE Plasma..."
tput_reset
#detect if KDE Plasma and SDDM are installed and if not install them
if [[ -z "$DDE" ]]; then
tput_cyan
echo
echo "No Desktop Environment detected. Installing KDE Plasma (light setup with SDDM)..."
tput_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
# Enable SDDM as the display manager
sudo systemctl enable sddm
# Enable graphical target
sudo systemctl set-default graphical.target
# Rebuild Discover cache
kbuildsycoca6
tput_green
echo
echo "KDE Plasma with SDDM installed successfully."
echo "You can reboot now to start KDE Plasma."
tput_reset
else
tput_cyan
echo
echo "You already have $DE installed."
tput_reset
# Check if LightDM is installed and active
if systemctl is-active --quiet lightdm; then
tput_yellow
echo
echo "LightDM is currently active. Replacing with SDDM..."
tput_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
# Enable graphical target
sudo systemctl set-default graphical.target
tput_green
echo
echo "LightDM removed and replaced with SDDM."
tput_reset
else
tput_cyan
echo
echo "No LightDM detected, leaving current display manager unchanged."
tput_reset
fi
fi
#cleanup unwanted packages
# Packages to remove
#packages=("vim" "vim-runtime" "vim-common" "vim-tiny" "mousepad" "parole")
#sudo apt-mark manual xfce4-goodies
# Function to check if a package is installed
is_package_installed() {
dpkg -s "$1" &> /dev/null
}
# Iterate over each package
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
# Resolving network issues
sudo mv /etc/network/interfaces /etc/network/interfaces.bak
sudo systemctl restart NetworkManager
# Remove leftover dependencies
sudo apt-get autoremove -y

27
v2/debian-server.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/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_cyan() { tput setaf 4; }
tput_purple() { tput setaf 5; }
tput_cyan() { tput setaf 6; }
tput_gray() { tput setaf 7; }
##########################
# 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}"
# Pause
read -n 1 -s -r -p "Press any key to continue"

27
v2/debian-workstation.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/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_cyan() { tput setaf 4; }
tput_purple() { tput setaf 5; }
tput_cyan() { tput setaf 6; }
tput_gray() { tput setaf 7; }
##########################
# 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}"
# Pause
read -n 1 -s -r -p "Press any key to continue"

87
v2/debian-xfce.sh Executable file
View File

@@ -0,0 +1,87 @@
#!/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; }
##########################
# 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}"
##########################
# 4. Desktop Environment installation
##########################
tput_yellow
echo "Installing XFCE..."
tput_reset
#detect if XFCE and SDDM are installed and if not install them
if [[ -z "$DDE" ]]; then
tput_cyan
echo
echo "No Desktop Environment detected. Installing XFCE (light setup with SDDM)..."
tput_reset
sudo apt update
sudo apt install -y --no-install-recommends sddm \
xfce4 \
xfce4-goodies
# Enable SDDM as the display manager
sudo systemctl enable sddm
# Enable graphical target
sudo systemctl set-default graphical.target
tput_green
echo
echo "XFCE with SDDM installed successfully."
echo "You can reboot now to start XFCE."
tput_reset
else
tput_cyan
echo
echo "You already have $DE installed."
tput_reset
# Check if LightDM is installed and active
if systemctl is-active --quiet lightdm; then
tput_yellow
echo
echo "LightDM is currently active. Replacing with SDDM..."
tput_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
tput_green
echo
echo "LightDM removed and replaced with SDDM."
tput_reset
else
tput_cyan
echo
echo "No LightDM detected, leaving current display manager unchanged."
tput_reset
fi
fi

348
v2/debian.sh Executable file
View File

@@ -0,0 +1,348 @@
#!/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_cyan() { tput setaf 4; }
tput_purple() { tput setaf 5; }
tput_cyan() { tput setaf 6; }
tput_gray() { tput setaf 7; }
##########################
# 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}"
tput_cyan
echo
echo "Starting Debian setup..."
tput_reset
echo
echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
##########################
# 0. Ensure curl is installed
##########################
if ! command -v curl >/dev/null 2>&1; then
tput_yellow
echo
echo "curl is not installed. Installing..."
tput_reset
sudo apt update
sudo apt -y install curl
fi
##########################
# 1. Add contrib and non-free if missing
##########################
tput_yellow
echo
echo "Checking /etc/apt/sources.list for contrib/non-free..."
tput_reset
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
tput_green
echo
echo "Updated sources.list to include contrib/non-free where needed."
tput_reset
##########################
# 1a. Check for archive.debian.org and update to deb.debian.org (only if Bullseye or newer)
##########################
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)
# Function to get numeric index of codename
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
tput_yellow
echo
echo "Found archive.debian.org in sources.list and system is Bullseye or newer, updating to deb.debian.org..."
tput_reset
sudo sed -i -r 's|archive\.debian\.org|deb.debian.org|g' /etc/apt/sources.list
tput_green
echo
echo "Updated sources.list to use deb.debian.org."
tput_reset
fi
##########################
# 2. Full update and upgrade
##########################
tput_yellow
echo
echo "Updating package lists..."
tput_reset
sudo apt update
# Autoremove before full-upgrade
AUTOREMOVE_PENDING=$(apt -s autoremove | grep -E 'Remv' || true)
if [[ -n "$AUTOREMOVE_PENDING" ]]; then
tput_yellow
echo
echo "Removing packages that are no longer required before upgrade..."
tput_reset
sudo apt -y autoremove
fi
tput_yellow
echo
echo "Upgrading installed packages..."
tput_reset
sudo apt -y full-upgrade
# Autoremove after full-upgrade
AUTOREMOVE_PENDING=$(apt -s autoremove | grep -E 'Remv' || true)
if [[ -n "$AUTOREMOVE_PENDING" ]]; then
tput_yellow
echo
echo "Removing packages that are no longer required after upgrade..."
tput_reset
sudo apt -y autoremove
fi
UPGRADE_PENDING=$(apt list --upgradable 2>/dev/null | grep -v Listing || true)
if [[ -n "$UPGRADE_PENDING" ]]; then
tput_red
echo
echo "Some packages were upgraded. A reboot is recommended before continuing."
tput_reset
read -rp "Reboot now? [y/N]: " reboot_choice
case "${reboot_choice,,}" in
y|yes)
tput_red
echo
echo "Rebooting now. After reboot, please restart this script to continue..."
tput_reset
sudo reboot
;;
*)
tput_yellow
echo
echo "Skipping reboot. Make sure to reboot manually before continuing upgrades."
tput_reset
exit 0
;;
esac
else
tput_green
echo
echo "All packages are up to date. Continuing to Debian major version check..."
tput_reset
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]}
tput_cyan
echo
echo "Current codename: $CURRENT_CODENAME"
echo "Latest stable codename: $LATEST_CODENAME"
tput_reset
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
tput_red
echo
echo "Error: Cannot determine next codename after $CURRENT_CODENAME"
tput_reset
exit 1
fi
tput_yellow
echo
echo "Detected codename $CURRENT_CODENAME, next stable version: $NEXT_CODENAME"
tput_reset
read -rp "Do you want to upgrade to $NEXT_CODENAME? [y/N]: " choice
case "${choice,,}" in
y|yes)
tput_yellow
echo
echo "Updating sources.list to $NEXT_CODENAME..."
tput_reset
sudo sed -i -r "s/\b$CURRENT_CODENAME\b/$NEXT_CODENAME/g" /etc/apt/sources.list
tput_yellow
echo
echo "Updating packages..."
tput_reset
sudo apt update
# Autoremove before full-upgrade
AUTOREMOVE_PENDING=$(apt -s autoremove | grep -E 'Remv' || true)
if [[ -n "$AUTOREMOVE_PENDING" ]]; then
tput_yellow
echo
echo "Removing packages that are no longer required before upgrade..."
tput_reset
sudo apt -y autoremove
fi
sudo apt -y full-upgrade
# Autoremove after full-upgrade
AUTOREMOVE_PENDING=$(apt -s autoremove | grep -E 'Remv' || true)
if [[ -n "$AUTOREMOVE_PENDING" ]]; then
tput_yellow
echo
echo "Removing packages that are no longer required after upgrade..."
tput_reset
sudo apt -y autoremove
fi
tput_green
echo
echo "Upgrade to $NEXT_CODENAME complete. A reboot is recommended."
tput_reset
read -rp "Press Enter to reboot..." _
sudo reboot
;;
*)
tput_yellow
echo
echo "Skipping upgrade to $NEXT_CODENAME. Continuing with current version."
tput_reset
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
tput_green
echo
echo "Debian is now at codename $CURRENT_CODENAME. Continuing with DE/TWM installation..."
tput_reset
##########################
# 4. Desktop Environment installation
##########################
case "$DE" in
xfce|plasma|gnome)
tput_yellow
echo
echo "Preparing to install $DE..."
tput_reset
# Run DE-specific script dynamically
SCRIPT_NAME="${OS}-${DE}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then
tput_cyan
echo
echo "Running $SCRIPT_NAME..."
tput_reset
bash "$SCRIPT_NAME"
else
tput_red
echo
echo "Error: $SCRIPT_NAME not found!"
tput_reset
exit 1
fi
;;
none)
tput_gray
echo
echo "No Desktop Environment selected, skipping DE installation."
tput_reset
;;
esac
##########################
# 5. Tiling Window Manager installation
##########################
case "$TWM" in
chadwm|hyprland)
tput_yellow
echo
echo "Installing CHADWM..."
tput_reset
# Run TWM-specific script dynamically
SCRIPT_NAME="${OS}-${TWM}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then
tput_cyan
echo
echo "Running $SCRIPT_NAME..."
tput_reset
bash "$SCRIPT_NAME"
else
tput_red
echo
echo "Error: $SCRIPT_NAME not found!"
tput_reset
exit 1
fi
;;
none)
tput_gray
echo
echo "No tiling window manager selected."
tput_reset
;;
esac
##########################
# 6. Installation level handling
##########################
case "$INSTALL_LEVEL" in
minimal|full|workstation|server)
tput_cyan
echo
echo "Minimal installation selected."
tput_reset
# Run Installation Level-specific script dynamically
SCRIPT_NAME="${OS}-${INSTALL_LEVEL}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then
tput_cyan
echo
echo "Running $SCRIPT_NAME..."
tput_reset
bash "$SCRIPT_NAME"
else
tput_red
echo
echo "Error: $SCRIPT_NAME not found!"
tput_reset
exit 1
fi
;;
esac
tput_green
echo
echo "Debian setup complete."
tput_reset

114
v2/fedora.sh Executable file
View File

@@ -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

114
v2/ubuntu.sh Executable file
View File

@@ -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