Migrate more apps to flatpaks
This commit is contained in:
1 parent
78e195ccde
commit
66a43ca3dd
1 file changed
+77
-101
+77
-101
@@ -8,67 +8,68 @@ exec > >(tee -a "$LOGFILE") 2>&1
|
||||
echo "=== Fedora New Machine Setup Started at $(date --iso-8601=seconds) ==="
|
||||
|
||||
if [[ ${EUID:-$(id -u)} -eq 0 ]]; then
|
||||
SUDO=""
|
||||
REAL_USER="${SUDO_USER:-root}"
|
||||
REAL_HOME="$(getent passwd "$REAL_USER" | cut -d: -f6)"
|
||||
SUDO=""
|
||||
REAL_USER="${SUDO_USER:-root}"
|
||||
REAL_HOME="$(getent passwd "$REAL_USER" | cut -d: -f6)"
|
||||
else
|
||||
SUDO="sudo"
|
||||
REAL_USER="$USER"
|
||||
REAL_HOME="$HOME"
|
||||
SUDO="sudo"
|
||||
REAL_USER="$USER"
|
||||
REAL_HOME="$HOME"
|
||||
fi
|
||||
|
||||
FEDORA_VER="$(rpm -E %fedora)"
|
||||
|
||||
run() {
|
||||
echo
|
||||
echo ">>> $*"
|
||||
"$@"
|
||||
echo
|
||||
echo ">>> $*"
|
||||
"$@"
|
||||
}
|
||||
|
||||
warn() {
|
||||
echo "WARNING: $*" >&2
|
||||
echo "WARNING: $*" >&2
|
||||
}
|
||||
|
||||
have_cmd() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
pkg_installed() {
|
||||
rpm -q "$1" >/dev/null 2>&1
|
||||
rpm -q "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
pkg_install() {
|
||||
local to_install=()
|
||||
local pkg
|
||||
local to_install=()
|
||||
local pkg
|
||||
|
||||
for pkg in "$@"; do
|
||||
if ! pkg_installed "$pkg"; then
|
||||
to_install+=("$pkg")
|
||||
fi
|
||||
done
|
||||
|
||||
if ((${#to_install[@]} == 0)); then
|
||||
echo "Packages already installed: $*"
|
||||
return 0
|
||||
for pkg in "$@"; do
|
||||
if ! pkg_installed "$pkg"; then
|
||||
to_install+=("$pkg")
|
||||
fi
|
||||
done
|
||||
|
||||
run $SUDO dnf install -y "${to_install[@]}" || warn "Some packages failed to install: ${to_install[*]}"
|
||||
if ((${#to_install[@]} == 0)); then
|
||||
echo "Packages already installed: $*"
|
||||
return 0
|
||||
fi
|
||||
|
||||
run $SUDO dnf install -y "${to_install[@]}" || warn "Some packages failed to install: ${to_install[*]}"
|
||||
}
|
||||
|
||||
flatpak_install() {
|
||||
local ref
|
||||
for ref in "$@"; do
|
||||
if flatpak info "$ref" >/dev/null 2>&1; then
|
||||
echo "Flatpak already installed: $ref"
|
||||
else
|
||||
run flatpak install -y flathub "$ref" || warn "Flatpak failed: $ref"
|
||||
fi
|
||||
done
|
||||
local ref
|
||||
|
||||
for ref in "$@"; do
|
||||
if flatpak info "$ref" >/dev/null 2>&1; then
|
||||
echo "Flatpak already installed: $ref"
|
||||
else
|
||||
run flatpak install -y flathub "$ref" || warn "Flatpak failed: $ref"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
write_vscode_repo() {
|
||||
run $SUDO rpm --import https://packages.microsoft.com/keys/microsoft.asc
|
||||
run $SUDO tee /etc/yum.repos.d/vscode.repo >/dev/null <<'EOF'
|
||||
run $SUDO rpm --import https://packages.microsoft.com/keys/microsoft.asc
|
||||
run $SUDO tee /etc/yum.repos.d/vscode.repo >/dev/null <<'EOF'
|
||||
[code]
|
||||
name=Visual Studio Code
|
||||
baseurl=https://packages.microsoft.com/yumrepos/vscode
|
||||
@@ -87,7 +88,7 @@ echo "Creating mount points..."
|
||||
run $SUDO mkdir -p /mnt/games /mnt/media
|
||||
|
||||
if have_cmd systemctl; then
|
||||
run $SUDO systemctl daemon-reload || true
|
||||
run $SUDO systemctl daemon-reload || true
|
||||
fi
|
||||
|
||||
echo
|
||||
@@ -97,9 +98,9 @@ pkg_install dnf-plugins-core
|
||||
echo
|
||||
echo "Installing RPM Fusion repos..."
|
||||
run $SUDO dnf install -y \
|
||||
"https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-${FEDORA_VER}.noarch.rpm" \
|
||||
"https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${FEDORA_VER}.noarch.rpm" \
|
||||
|| warn "RPM Fusion install failed or repos may already exist"
|
||||
"https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-${FEDORA_VER}.noarch.rpm" \
|
||||
"https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${FEDORA_VER}.noarch.rpm" \
|
||||
|| warn "RPM Fusion install failed or repos may already exist"
|
||||
|
||||
echo
|
||||
echo "Enabling Flatpak + Flathub..."
|
||||
@@ -114,28 +115,26 @@ echo
|
||||
echo "Installing multimedia codecs..."
|
||||
run $SUDO dnf swap -y ffmpeg-free ffmpeg --allowerasing || warn "ffmpeg swap failed"
|
||||
run $SUDO dnf install -y \
|
||||
mozilla-openh264 \
|
||||
gstreamer1-plugins-bad-freeworld \
|
||||
ffmpeg \
|
||||
|| warn "Codec package install failed"
|
||||
mozilla-openh264 \
|
||||
gstreamer1-plugins-bad-freeworld \
|
||||
ffmpeg \
|
||||
|| warn "Codec package install failed"
|
||||
run $SUDO dnf update -y @multimedia --setopt=install_weak_deps=False --exclude=PackageKit-gstreamer-plugin \
|
||||
|| warn "Multimedia group update failed"
|
||||
|| warn "Multimedia group update failed"
|
||||
|
||||
echo
|
||||
echo "Installing common RPM apps..."
|
||||
pkg_install \
|
||||
filezilla \
|
||||
git \
|
||||
hugo \
|
||||
NetworkManager-openvpn \
|
||||
openvpn \
|
||||
qbittorrent \
|
||||
steam \
|
||||
thunderbird \
|
||||
oh-my-posh \
|
||||
openrgb \
|
||||
screenfetch \
|
||||
yt-dlp
|
||||
git \
|
||||
hugo \
|
||||
NetworkManager-openvpn \
|
||||
openvpn \
|
||||
qbittorrent \
|
||||
steam \
|
||||
oh-my-posh \
|
||||
openrgb \
|
||||
screenfetch \
|
||||
yt-dlp
|
||||
|
||||
echo
|
||||
echo "Installing fonts..."
|
||||
@@ -148,57 +147,34 @@ write_vscode_repo
|
||||
run $SUDO dnf makecache -y || warn "dnf makecache failed"
|
||||
pkg_install code
|
||||
|
||||
echo
|
||||
echo "Installing optional RPM apps..."
|
||||
pkg_install discord || warn "discord not available from enabled repos"
|
||||
|
||||
echo
|
||||
echo "Installing Flatpaks..."
|
||||
flatpak_install \
|
||||
org.signal.Signal \
|
||||
com.bitwarden.desktop \
|
||||
io.github.martinrotter.rssguard \
|
||||
com.spotify.Client \
|
||||
io.github.Archeb.opentrace
|
||||
org.signal.Signal \
|
||||
com.bitwarden.desktop \
|
||||
io.github.martinrotter.rssguard \
|
||||
com.spotify.Client \
|
||||
io.github.Archeb.opentrace \
|
||||
org.filezillaproject.Filezilla \
|
||||
org.mozilla.Thunderbird \
|
||||
com.discordapp.Discord
|
||||
|
||||
echo
|
||||
echo "Setting ownership hint for /mnt/games..."
|
||||
echo "After you mount the ext4 games partition, you may want:"
|
||||
echo " sudo chown -R ${REAL_USER}:${REAL_USER} /mnt/games"
|
||||
echo "Configuring Flatpak access to mounted media..."
|
||||
run flatpak override --user --filesystem=/mnt/media org.filezillaproject.Filezilla \
|
||||
|| warn "Could not grant FileZilla access to /mnt/media"
|
||||
|
||||
cat <<EOF
|
||||
echo
|
||||
echo "Setting ownership hint for mounted directories..."
|
||||
echo "After you mount the ext4 games/media partitions, you may want:"
|
||||
echo " sudo chown -R ${REAL_USER}:${REAL_USER} /mnt/games /mnt/media"
|
||||
|
||||
=== Setup completed at $(date --iso-8601=seconds) ===
|
||||
Check log: $LOGFILE
|
||||
echo
|
||||
echo "qBittorrent note: keep the RPM build for host-level VPN adapter binding."
|
||||
echo "After connecting OpenVPN, select its tun interface in qBittorrent:"
|
||||
echo " Tools -> Options -> Advanced -> Network interface"
|
||||
echo "Then restart qBittorrent and verify transfers stop when the VPN disconnects."
|
||||
|
||||
Manual mount follow-up:
|
||||
|
||||
1. Find UUIDs:
|
||||
lsblk -f
|
||||
|
||||
2. Back up fstab:
|
||||
sudo cp /etc/fstab /etc/fstab.bak
|
||||
|
||||
3. Add entries like these:
|
||||
|
||||
# ext4 games partition
|
||||
UUID=XXXXXX-XXXX /mnt/games ext4 defaults,nofail 0 2
|
||||
|
||||
# example media partition if still NTFS
|
||||
UUID=YYYYYY-YYYY /mnt/media ntfs defaults,nofail,uid=1000,gid=1000 0 0
|
||||
|
||||
4. Test mounts:
|
||||
sudo mount -a
|
||||
|
||||
5. For the ext4 games partition, fix ownership if needed:
|
||||
sudo chown -R ${REAL_USER}:${REAL_USER} /mnt/games
|
||||
|
||||
6. Reboot and verify.
|
||||
|
||||
Notes:
|
||||
- /mnt/games is assumed to be ext4.
|
||||
- Signal Desktop is installed via Flatpak only.
|
||||
- ext4 stores ownership/permissions in the filesystem itself.
|
||||
- Use KDE Partition Manager or GNOME Disks if you prefer a GUI.
|
||||
|
||||
EOF
|
||||
echo
|
||||
echo "=== Fedora New Machine Setup Finished at $(date --iso-8601=seconds) ==="
|
||||
echo "Log saved to: $LOGFILE"
|
||||
Reference in new issue
Block a user