v3-revamp-fedora

This commit is contained in:
2026-07-06 14:46:53 +02:00
parent cb66491c26
commit b2b11b98eb
2 changed files with 84 additions and 105 deletions
+38 -39
View File
@@ -17,12 +17,11 @@ 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"; }
color_yellow() { printf '%b' "$YELLOW"; }
color_cyan() { printf '%b' "$CYAN"; }
color_red() { printf '%b' "$RED"; }
color_green() { printf '%b' "$GREEN"; }
color_reset() { printf '%b' "$RESET"; }
#------------------------------------------
# Use exported variables from main detection script
@@ -35,9 +34,9 @@ INSTALL_LEVEL="${INSTALL_LEVEL}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo
say_cyan "Starting Fedora setup..."
color_cyan "Starting Fedora setup..."
echo
say_gray "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
color_gray "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
#------------------------------------------
# Helper functions
@@ -54,7 +53,7 @@ remove_packages() {
done
if [ ${#packages_to_remove[@]} -gt 0 ]; then
say_cyan "Removing packages: ${packages_to_remove[*]}"
color_cyan "Removing packages: ${packages_to_remove[*]}"
sudo dnf remove -y "${packages_to_remove[@]}"
fi
}
@@ -63,14 +62,14 @@ remove_packages() {
# 0. Ensure base is ready for installation
#------------------------------------------
if ! command -v curl >/dev/null 2>&1; then
say_yellow "curl is not installed. Installing..."
color_yellow "curl is not installed. Installing..."
install_packages curl
fi
#------------------------------------------
# 1. Update and Enable Repos
#------------------------------------------
say_cyan "Optimizing DNF for speed..."
color_cyan "Optimizing DNF for speed..."
# 1. Enable fastest mirror (lowest latency)
# 2. Increase parallel downloads (allows downloading multiple packages at once)
@@ -80,24 +79,24 @@ sudo dnf config-manager setopt fastestmirror=1
sudo dnf config-manager setopt max_parallel_downloads=20
sudo dnf config-manager setopt defaultyes=True
say_green "DNF optimized. Refreshing metadata..."
color_green "DNF optimized. Refreshing metadata..."
sudo dnf makecache --refresh
say_cyan "Enabling RPM Fusion repositories for Fedora $(rpm -E %fedora)..."
color_cyan "Enabling RPM Fusion repositories for Fedora $(rpm -E %fedora)..."
# Define the version variable for readability
FEDORA_VER=$(rpm -E %fedora)
say_yellow "Checking for updates and sources..."
color_yellow "Checking for updates and sources..."
sudo dnf check-update || true
# Check if flatpak is installed, if not, install it
if ! command -v flatpak &> /dev/null; then
say_yellow "Flatpak not found. Installing..."
color_yellow "Flatpak not found. Installing..."
sudo dnf install -y flatpak
fi
say_cyan "Enabling Flathub..."
color_cyan "Enabling Flathub..."
# Using --if-not-exists is good practice to prevent errors on re-runs
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
@@ -105,41 +104,41 @@ sudo dnf install -y \
"https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-${FEDORA_VER}.noarch.rpm" \
"https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${FEDORA_VER}.noarch.rpm"
say_cyan "Enabling full Flathub support..."
color_cyan "Enabling full Flathub support..."
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Update the system
say_gray "Updating the system"
color_gray "Updating the system"
echo
sudo dnf update -y
#------------------------------------------
# 3. Detected OS / DE / TWM info
#------------------------------------------
say_yellow "Detected OS / Desktop Environment / Tiling Window Manager"
color_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"
color_gray "Installing OS-specific packages..."
color_gray "Selected DE: $DE"
color_gray "Selected TWM: $TWM"
color_gray "Installation Level: $INSTALL_LEVEL"
#------------------------------------------
# 4. Desktop Environment installation
#------------------------------------------
case "$DE" in
xfce|plasma|gnome)
say_yellow "Preparing to install $DE..."
color_yellow "Preparing to install $DE..."
SCRIPT_NAME="$SCRIPT_DIR/${OS}-${DE}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then
say_cyan "Running $SCRIPT_NAME..."
color_cyan "Running $SCRIPT_NAME..."
bash "$SCRIPT_NAME"
else
say_red "Error: $SCRIPT_NAME not found!"
color_red "Error: $SCRIPT_NAME not found!"
exit 1
fi
;;
none)
say_gray "No Desktop Environment selected, skipping DE installation."
color_gray "No Desktop Environment selected, skipping DE installation."
;;
esac
@@ -148,18 +147,18 @@ esac
#------------------------------------------
case "$TWM" in
chadwm|hyprland|niri)
say_yellow "Installing $TWM..."
color_yellow "Installing $TWM..."
SCRIPT_NAME="$SCRIPT_DIR/${OS}-${TWM}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then
say_cyan "Running $SCRIPT_NAME..."
color_cyan "Running $SCRIPT_NAME..."
bash "$SCRIPT_NAME"
else
say_red "Error: $SCRIPT_NAME not found!"
color_red "Error: $SCRIPT_NAME not found!"
exit 1
fi
;;
none)
say_gray "No tiling window manager selected, skipping TWM installation."
color_gray "No tiling window manager selected, skipping TWM installation."
;;
esac
@@ -168,33 +167,33 @@ esac
#------------------------------------------
case "$INSTALL_LEVEL" in
minimal|full|workstation|server)
say_cyan "Installation level: $INSTALL_LEVEL"
color_cyan "Installation level: $INSTALL_LEVEL"
SCRIPT_NAME="$SCRIPT_DIR/${OS}-${INSTALL_LEVEL}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then
say_cyan "Running $SCRIPT_NAME..."
color_cyan "Running $SCRIPT_NAME..."
bash "$SCRIPT_NAME"
else
say_red "Error: $SCRIPT_NAME not found!"
color_red "Error: $SCRIPT_NAME not found!"
exit 1
fi
;;
esac
say_green "Fedora setup complete."
say_red "The installation has finished. A reboot is recommended."
color_green "Fedora setup complete."
color_red "The installation has finished. A reboot is recommended."
# Reboots are dangerous to automate; we use a shorter timeout and default to No
if read -t 10 -rp "Reboot now? [y/N]: " reboot_choice; then
case "${reboot_choice,,}" in
y|yes)
say_red "Rebooting now."
color_red "Rebooting now."
sudo reboot
;;
*)
say_yellow "Skipping reboot."
color_yellow "Skipping reboot."
exit 0
;;
esac
else
say_yellow "\nNo input detected. Skipping reboot for safety."
color_yellow "\nNo input detected. Skipping reboot for safety."
exit 0
fi