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
+46 -66
View File
@@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
########################## #------------------------------------------
# Color helpers (printf-safe, no tput) # Color helpers (printf-safe, no tput)
########################## #------------------------------------------
RED="\033[0;31m" RED="\033[0;31m"
GREEN="\033[0;32m" GREEN="\033[0;32m"
YELLOW="\033[0;33m" YELLOW="\033[0;33m"
@@ -17,109 +17,89 @@ if [ ! -t 1 ]; then
RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET="" RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi fi
say_red() { printf "\n"; printf "%b%s%b\n" "$RED" "$*" "$RESET"; } color_yellow() { printf '%b' "$YELLOW"; }
say_green() { printf "\n"; printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; } color_cyan() { printf '%b' "$CYAN"; }
say_yellow() { printf "\n"; printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; } color_red() { printf '%b' "$RED"; }
say_cyan() { printf "\n"; printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; } color_green() { printf '%b' "$GREEN"; }
say_gray() { printf "\n"; printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; } color_reset() { printf '%b' "$RESET"; }
say_bold() { printf "\n"; printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
########################## #------------------------------------------
# Use exported variables from main detection script # Use exported variables from main detection script
########################## #------------------------------------------
OS="${DETECTED_OS}" OS="${DETECTED_OS:-unknown}"
DDE="${DETECTED_DE}" DDE="${DETECTED_DE:-unknown}"
DE="${SELECTED_DE:-none}" DE="${SELECTED_DE:-none}"
TWM="${SELECTED_TWM:-none}" TWM="${SELECTED_TWM:-none}"
INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" SYS_INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
########################## #------------------------------------------
# Helper functions # Helper functions
########################## #------------------------------------------
install_packages() { sudo dnf install -y "$@"; } install_packages() { sudo dnf install -y "$@"; }
is_package_installed() { rpm -q "$@" &>/dev/null; } is_package_installed() { rpm -q "$@" &>/dev/null; }
########################## #------------------------------------------
# 1. Base Dependencies & Repos # 1. Base Dependencies & Repos
########################## #------------------------------------------
say_cyan "Installing base dependencies..." color_cyan; echo "Installing base dependencies..."; color_reset
# dnf-plugins-core is required for COPR # dnf-plugins-core is required for COPR
install_packages dnf-plugins-core curl wget git flatpak install_packages dnf-plugins-core wget
# Enable PeaZip via COPR #------------------------------------------
say_cyan "Installing PeaZip (Qt6) via official RPM..."
PZ_VER="11.0.0"
PZ_FILE="peazip-${PZ_VER}.LINUX.Qt6-1.x86_64.rpm"
PZ_URL="https://github.com/peazip/PeaZip/releases/download/${PZ_VER}/${PZ_FILE}"
curl -L "$PZ_URL" -o "/tmp/$PZ_FILE"
sudo dnf install -y "/tmp/$PZ_FILE"
rm "/tmp/$PZ_FILE"
say_green "PeaZip ${PZ_VER} (Qt6) installed successfully."
##########################
# 2. Main Package Installation # 2. Main Package Installation
########################## #------------------------------------------
say_yellow "Installing essential tools..." color_yellow; echo "Installing essential tools..."; color_reset
# 1. Install universal base packages (minus the polkit agent)
install_packages \ install_packages \
fastfetch lolcat bash-completion alacritty \ fastfetch bash-completion alacritty \
hwinfo lshw duf chrony polkit-kde-agent-1 \ hwinfo lshw duf chrony \
man-db tree xdg-user-dirs rsync time bat chromium \ man-db tree xdg-user-dirs rsync time bat \
thunar thunar-archive-plugin thunar-volman \ thunar thunar-archive-plugin thunar-volman \
baobab gvfs-smb hddtemp squashfs-tools \ baobab gvfs-smb hddtemp squashfs-tools \
zip gzip p7zip unace unrar file-roller peazip \ zip gzip p7zip unace unrar xarchiver \
feh gnome-font-viewer dconf-editor hardinfo2 lsb_release \ feh gnome-font-viewer dconf-editor hardinfo2 lsb_release \
powertop inxi acpi plocate nm-connection-editor \ powertop inxi acpi plocate nm-connection-editor \
python3-pylint qt6-qtsvg qt6-qtvirtualkeyboard qt6-qtmultimedia python3-pylint qt6-qtsvg qt6-qtvirtualkeyboard qt6-qtmultimedia
# 2. Inject the correct Polkit agent & PeaZip based on environment
color_cyan; echo "Tailoring toolkits for $DE / $TWM..."; color_reset
if [[ "$DE" == "plasma" || "$TWM" == "hyprland" ]]; then
install_packages polkit-kde-agent-1 peazip-common peazip-qt6
else
# XFCE, GNOME, Niri, CHADWM (Uses lightweight generic toolkits)
install_packages xfce-polkit peazip-common peazip-gtk3
fi
if ! command -v starship &> /dev/null; then if ! command -v starship &> /dev/null; then
say_cyan "Installing Starship shell prompt..." color_cyan; echo "Installing Starship shell prompt..."; color_reset
curl -sS https://starship.rs/install.sh | sh -s -- -y curl -sS https://starship.rs/install.sh | sh -s -- -y
fi fi
################################# #------------------------------------------
# 3. Fonts (RobotoMono Nerd Font) # 3. Fonts (RobotoMono Nerd Font)
################################# #------------------------------------------
FONT_DIR="$HOME/.local/share/fonts" FONT_DIR="$HOME/.local/share/fonts"
DOWNLOAD_NAME="RobotoMono" DOWNLOAD_NAME="RobotoMono"
if ! find "$FONT_DIR" -name "*RobotoMonoNerdFont*" | grep -q .; then if ! find "$FONT_DIR" -name "*RobotoMonoNerdFont*" | grep -q .; then
say_yellow "Installing ${DOWNLOAD_NAME} Nerd Font..." color_yellow; echo "Installing ${DOWNLOAD_NAME} Nerd Font..."; color_reset
mkdir -p "$FONT_DIR" mkdir -p "$FONT_DIR"
FONT_ZIP="/tmp/${DOWNLOAD_NAME}.zip" FONT_ZIP="/tmp/${DOWNLOAD_NAME}.zip"
curl -L "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${DOWNLOAD_NAME}.zip" -o "$FONT_ZIP" curl -L "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${DOWNLOAD_NAME}.zip" -o "$FONT_ZIP"
unzip -oq "$FONT_ZIP" -d "$FONT_DIR" unzip -oq "$FONT_ZIP" -d "$FONT_DIR"
fc-cache -fv fc-cache -fv
rm "$FONT_ZIP" rm "$FONT_ZIP"
say_green "${DOWNLOAD_NAME} installed." color_green; echo "${DOWNLOAD_NAME} installed."; color_reset
else else
say_yellow "RobotoMono Nerd Font already installed." color_yellow; echo "RobotoMono Nerd Font already installed."; color_reset
fi fi
################################# #------------------------------------------
# 4. Chromium Configuration # 4. Enable Services
################################# #------------------------------------------
CONF="$HOME/.config/chromium-flags.conf" color_cyan; echo "Enabling services..."; color_reset
mkdir -p "$(dirname "$CONF")"
[[ ! -f "$CONF" ]] && touch "$CONF"
# Add OAuth IDs for Google Sync
#
OAUTH_ID="--oauth2-client-id=77185425430.apps.googleusercontent.com"
OAUTH_SECRET="--oauth2-client-secret=OTJgUOQcT7lO7GsGZq2G4IlT"
grep -qxF -- "$OAUTH_ID" "$CONF" || echo "$OAUTH_ID" >> "$CONF"
grep -qxF -- "$OAUTH_SECRET" "$CONF" || echo "$OAUTH_SECRET" >> "$CONF"
say_green "Chromium flags configured."
#################################
# 5. Enable Services
#################################
# Enable basic services
say_cyan "Enabling services..."
sudo systemctl enable --now fstrim.timer sudo systemctl enable --now fstrim.timer
sudo systemctl enable --now chronyd || true sudo systemctl enable --now chronyd || true
say_green "Fedora Minimal setup completed." color_green; echo "Fedora Minimal setup completed."; color_reset
+38 -39
View File
@@ -17,12 +17,11 @@ if [ ! -t 1 ]; then
RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET="" RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi fi
say_red() { printf "\n"; printf "%b%s%b\n" "$RED" "$*" "$RESET"; } color_yellow() { printf '%b' "$YELLOW"; }
say_green() { printf "\n"; printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; } color_cyan() { printf '%b' "$CYAN"; }
say_yellow() { printf "\n"; printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; } color_red() { printf '%b' "$RED"; }
say_cyan() { printf "\n"; printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; } color_green() { printf '%b' "$GREEN"; }
say_gray() { printf "\n"; printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; } color_reset() { printf '%b' "$RESET"; }
say_bold() { printf "\n"; printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
#------------------------------------------ #------------------------------------------
# Use exported variables from main detection script # Use exported variables from main detection script
@@ -35,9 +34,9 @@ INSTALL_LEVEL="${INSTALL_LEVEL}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo echo
say_cyan "Starting Fedora setup..." color_cyan "Starting Fedora setup..."
echo echo
say_gray "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" color_gray "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
#------------------------------------------ #------------------------------------------
# Helper functions # Helper functions
@@ -54,7 +53,7 @@ remove_packages() {
done done
if [ ${#packages_to_remove[@]} -gt 0 ]; then 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[@]}" sudo dnf remove -y "${packages_to_remove[@]}"
fi fi
} }
@@ -63,14 +62,14 @@ remove_packages() {
# 0. Ensure base is ready for installation # 0. Ensure base is ready for installation
#------------------------------------------ #------------------------------------------
if ! command -v curl >/dev/null 2>&1; then 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 install_packages curl
fi fi
#------------------------------------------ #------------------------------------------
# 1. Update and Enable Repos # 1. Update and Enable Repos
#------------------------------------------ #------------------------------------------
say_cyan "Optimizing DNF for speed..." color_cyan "Optimizing DNF for speed..."
# 1. Enable fastest mirror (lowest latency) # 1. Enable fastest mirror (lowest latency)
# 2. Increase parallel downloads (allows downloading multiple packages at once) # 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 max_parallel_downloads=20
sudo dnf config-manager setopt defaultyes=True sudo dnf config-manager setopt defaultyes=True
say_green "DNF optimized. Refreshing metadata..." color_green "DNF optimized. Refreshing metadata..."
sudo dnf makecache --refresh 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 # Define the version variable for readability
FEDORA_VER=$(rpm -E %fedora) FEDORA_VER=$(rpm -E %fedora)
say_yellow "Checking for updates and sources..." color_yellow "Checking for updates and sources..."
sudo dnf check-update || true sudo dnf check-update || true
# Check if flatpak is installed, if not, install it # Check if flatpak is installed, if not, install it
if ! command -v flatpak &> /dev/null; then if ! command -v flatpak &> /dev/null; then
say_yellow "Flatpak not found. Installing..." color_yellow "Flatpak not found. Installing..."
sudo dnf install -y flatpak sudo dnf install -y flatpak
fi fi
say_cyan "Enabling Flathub..." color_cyan "Enabling Flathub..."
# Using --if-not-exists is good practice to prevent errors on re-runs # 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 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/free/fedora/rpmfusion-free-release-${FEDORA_VER}.noarch.rpm" \
"https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-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 flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Update the system # Update the system
say_gray "Updating the system" color_gray "Updating the system"
echo echo
sudo dnf update -y sudo dnf update -y
#------------------------------------------ #------------------------------------------
# 3. Detected OS / DE / TWM info # 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 echo
say_gray "Installing OS-specific packages..." color_gray "Installing OS-specific packages..."
say_gray "Selected DE: $DE" color_gray "Selected DE: $DE"
say_gray "Selected TWM: $TWM" color_gray "Selected TWM: $TWM"
say_gray "Installation Level: $INSTALL_LEVEL" color_gray "Installation Level: $INSTALL_LEVEL"
#------------------------------------------ #------------------------------------------
# 4. Desktop Environment installation # 4. Desktop Environment installation
#------------------------------------------ #------------------------------------------
case "$DE" in case "$DE" in
xfce|plasma|gnome) xfce|plasma|gnome)
say_yellow "Preparing to install $DE..." color_yellow "Preparing to install $DE..."
SCRIPT_NAME="$SCRIPT_DIR/${OS}-${DE}.sh" SCRIPT_NAME="$SCRIPT_DIR/${OS}-${DE}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then if [[ -f "$SCRIPT_NAME" ]]; then
say_cyan "Running $SCRIPT_NAME..." color_cyan "Running $SCRIPT_NAME..."
bash "$SCRIPT_NAME" bash "$SCRIPT_NAME"
else else
say_red "Error: $SCRIPT_NAME not found!" color_red "Error: $SCRIPT_NAME not found!"
exit 1 exit 1
fi fi
;; ;;
none) none)
say_gray "No Desktop Environment selected, skipping DE installation." color_gray "No Desktop Environment selected, skipping DE installation."
;; ;;
esac esac
@@ -148,18 +147,18 @@ esac
#------------------------------------------ #------------------------------------------
case "$TWM" in case "$TWM" in
chadwm|hyprland|niri) chadwm|hyprland|niri)
say_yellow "Installing $TWM..." color_yellow "Installing $TWM..."
SCRIPT_NAME="$SCRIPT_DIR/${OS}-${TWM}.sh" SCRIPT_NAME="$SCRIPT_DIR/${OS}-${TWM}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then if [[ -f "$SCRIPT_NAME" ]]; then
say_cyan "Running $SCRIPT_NAME..." color_cyan "Running $SCRIPT_NAME..."
bash "$SCRIPT_NAME" bash "$SCRIPT_NAME"
else else
say_red "Error: $SCRIPT_NAME not found!" color_red "Error: $SCRIPT_NAME not found!"
exit 1 exit 1
fi fi
;; ;;
none) none)
say_gray "No tiling window manager selected, skipping TWM installation." color_gray "No tiling window manager selected, skipping TWM installation."
;; ;;
esac esac
@@ -168,33 +167,33 @@ esac
#------------------------------------------ #------------------------------------------
case "$INSTALL_LEVEL" in case "$INSTALL_LEVEL" in
minimal|full|workstation|server) minimal|full|workstation|server)
say_cyan "Installation level: $INSTALL_LEVEL" color_cyan "Installation level: $INSTALL_LEVEL"
SCRIPT_NAME="$SCRIPT_DIR/${OS}-${INSTALL_LEVEL}.sh" SCRIPT_NAME="$SCRIPT_DIR/${OS}-${INSTALL_LEVEL}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then if [[ -f "$SCRIPT_NAME" ]]; then
say_cyan "Running $SCRIPT_NAME..." color_cyan "Running $SCRIPT_NAME..."
bash "$SCRIPT_NAME" bash "$SCRIPT_NAME"
else else
say_red "Error: $SCRIPT_NAME not found!" color_red "Error: $SCRIPT_NAME not found!"
exit 1 exit 1
fi fi
;; ;;
esac esac
say_green "Fedora setup complete." color_green "Fedora setup complete."
say_red "The installation has finished. A reboot is recommended." color_red "The installation has finished. A reboot is recommended."
# Reboots are dangerous to automate; we use a shorter timeout and default to No # 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 if read -t 10 -rp "Reboot now? [y/N]: " reboot_choice; then
case "${reboot_choice,,}" in case "${reboot_choice,,}" in
y|yes) y|yes)
say_red "Rebooting now." color_red "Rebooting now."
sudo reboot sudo reboot
;; ;;
*) *)
say_yellow "Skipping reboot." color_yellow "Skipping reboot."
exit 0 exit 0
;; ;;
esac esac
else else
say_yellow "\nNo input detected. Skipping reboot for safety." color_yellow "\nNo input detected. Skipping reboot for safety."
exit 0 exit 0
fi fi