138 lines
4.3 KiB
Bash
Executable File
138 lines
4.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# Map the exported variables to your local names with fallbacks to satisfy set -u
|
|
OS="${DETECTED_OS:-fedora}"
|
|
DE="${SELECTED_DE:-none}"
|
|
TWM="${SELECTED_TWM:-none}"
|
|
INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}"
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
echo
|
|
color_cyan "Starting Fedora Minimal setup..."
|
|
echo
|
|
|
|
#------------------------------------------
|
|
# Helper functions
|
|
#------------------------------------------
|
|
install_packages() { sudo dnf install -y "$@"; }
|
|
is_package_installed() { rpm -q "$@" &>/dev/null; }
|
|
|
|
remove_packages() {
|
|
local packages_to_remove=()
|
|
for pkg in "$@"; do
|
|
if is_package_installed "$pkg"; then
|
|
packages_to_remove+=("$pkg")
|
|
fi
|
|
done
|
|
|
|
if [ ${#packages_to_remove[@]} -gt 0 ]; then
|
|
color_cyan "Removing packages: ${packages_to_remove[*]}"
|
|
sudo dnf remove -y "${packages_to_remove[@]}"
|
|
fi
|
|
}
|
|
|
|
#------------------------------------------
|
|
# 1. Base Dependencies & Repos
|
|
#------------------------------------------
|
|
color_cyan; echo "Installing base dependencies..."
|
|
# dnf-plugins-core is required for COPR
|
|
install_packages dnf-plugins-core wget
|
|
|
|
pause_if_debug
|
|
|
|
#------------------------------------------
|
|
# 2. Main Package Installation
|
|
#------------------------------------------
|
|
color_yellow; echo "Installing essential tools..."
|
|
|
|
# 1. Install universal base packages (minus the polkit agent)
|
|
install_packages \
|
|
fastfetch bash-completion alacritty \
|
|
hwinfo lshw duf chrony \
|
|
man-db tree xdg-user-dirs rsync time bat \
|
|
thunar thunar-archive-plugin thunar-volman \
|
|
baobab gvfs-smb hddtemp squashfs-tools \
|
|
zip gzip p7zip unace unrar xarchiver chromium \
|
|
feh gnome-font-viewer dconf-editor hardinfo2 lsb_release \
|
|
powertop inxi acpi plocate nm-connection-editor \
|
|
python3-pylint qt6-qtsvg qt6-qtvirtualkeyboard qt6-qtmultimedia \
|
|
arandr catfish galculator NetworkManager network-manager-applet \
|
|
NetworkManager-openvpn numlockx pipewire pipewire-alsa pipewire-pulse \
|
|
wireplumber pavucontrol playerctl gparted xfce4-pulseaudio-plugin xfce4-clipman-plugin
|
|
# temp disabled packages
|
|
# xfce4-indicator-plugin
|
|
|
|
pause_if_debug
|
|
|
|
# 2. Inject the correct Polkit agent & PeaZip based on environment
|
|
color_cyan; echo "Tailoring toolkits for $DE / $TWM..."
|
|
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
|
|
color_cyan; echo "Installing Starship shell prompt..."
|
|
curl -sS https://starship.rs/install.sh | sh -s -- -y
|
|
fi
|
|
|
|
pause_if_debug
|
|
|
|
#------------------------------------------
|
|
# 3. Fonts (RobotoMono Nerd Font)
|
|
#------------------------------------------
|
|
FONT_DIR="$HOME/.local/share/fonts"
|
|
DOWNLOAD_NAME="RobotoMono"
|
|
if ! find "$FONT_DIR" -name "*RobotoMonoNerdFont*" | grep -q .; then
|
|
color_yellow; echo "Installing ${DOWNLOAD_NAME} Nerd Font..."
|
|
mkdir -p "$FONT_DIR"
|
|
FONT_ZIP="/tmp/${DOWNLOAD_NAME}.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"
|
|
fc-cache -fv
|
|
rm "$FONT_ZIP"
|
|
color_green; echo "${DOWNLOAD_NAME} installed."
|
|
else
|
|
color_yellow; echo "RobotoMono Nerd Font already installed."
|
|
fi
|
|
|
|
pause_if_debug
|
|
|
|
#------------------------------------------
|
|
# 4. Enable Services
|
|
#------------------------------------------
|
|
color_cyan "Enabling services..."
|
|
|
|
sudo systemctl enable --now fstrim.timer
|
|
sudo systemctl enable --now chronyd || true
|
|
|
|
# Ensure NetworkManager manages all interfaces
|
|
color_yellow "Ensuring NetworkManager service is enabled and running..."
|
|
sudo systemctl enable --now NetworkManager
|
|
|
|
color_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
|
|
|
|
color_yellow "Restarting NetworkManager service..."
|
|
sudo systemctl restart NetworkManager
|
|
|
|
color_yellow "Waiting for NetworkManager to reconnect..."
|
|
sleep 15
|
|
|
|
pause_if_debug
|
|
|
|
# Enable pipewire
|
|
systemctl --user enable pipewire pipewire-pulse wireplumber
|
|
|
|
pause_if_debug
|
|
|
|
color_green "Fedora Minimal setup completed." |