Skip to content

Commit

Permalink
feat: Switch to system level flatpaks (ublue-os#790)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo authored Jan 29, 2024
1 parent 4dcd42b commit 2a509af
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 48 deletions.
31 changes: 8 additions & 23 deletions usr/bin/ublue-system-flatpak-manager
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# Script Version
VER=1
VER=2
VER_FILE="/etc/ublue/flatpak_manager_version"
VER_RAN=$(cat $VER_FILE)

Expand All @@ -11,11 +11,16 @@ if [[ -f $VER_FILE && $VER = $VER_RAN ]]; then
exit 0
fi

# Remove fedora flatpak repo
# Opt out of and remove Fedora's flatpak repo
if grep -qz 'fedora' <<< $(flatpak remotes); then
flatpak remote-delete --user fedora --force
/usr/lib/fedora-third-party/fedora-third-party-opt-out
/usr/bin/fedora-third-party disable
flatpak remote-delete fedora --force
fi

# Ensure Flathub is enabled
flatpak remote-modify --system --enable flathub

# Lists of flatpaks
FLATPAK_LIST=$(flatpak list --columns=application)
INSTALL_LIST=$(cat /etc/flatpak/system/install)
Expand All @@ -34,25 +39,5 @@ if [[ ! -f $VER_FILE && -n $REMOVE_LIST ]]; then
flatpak remove --system --noninteractive ${REMOVE_LIST[@]}
fi

# Opt out of and remove Fedora's flatpak repo
if grep -qz 'fedora' <<< $(flatpak remotes); then
/usr/lib/fedora-third-party/fedora-third-party-opt-out
/usr/bin/fedora-third-party disable
flatpak remote-delete fedora --force

# Remove flatpak apps from origin fedora
FEDORA_FLATPAKS=$(flatpak list --app --columns=application,origin | grep -w 'fedora' | awk '{print $1}')
flatpak remove --system --noninteractive ${FEDORA_FLATPAKS[@]}

# Remove flatpak runtimes from origin fedora
FEDORA_FLATPAKS=$(flatpak list --runtime --columns=application,arch,branch,origin | grep -w 'fedora' | awk '{print $1"/"$2"/"$3}')
flatpak remove --system --noninteractive ${FEDORA_FLATPAKS[@]}
fi

# Disable the system variant of the flathub repo
flatpak remote-modify flathub --disable --system

notify-send "Flatpak installer" "Finished installing system flatpaks" --app-name="Flatpak installer" -u NORMAL

mkdir -p /etc/ublue
echo $VER > $VER_FILE
6 changes: 5 additions & 1 deletion usr/bin/ublue-user-flatpak-manager
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ if [[ -f $VER_FILE && $VER = $VER_RAN ]]; then
exit 0
fi

# Setup Flathub
# Enable Flathub
if grep -qz 'fedora' <<< $(flatpak remotes); then
flatpak remote-delete --user fedora --force
fi
flatpak remote-add --if-not-exists --user flathub /etc/flatpak/remotes.d/flathub.flatpakrepo
flatpak remote-modify --user --enable flathub

# Lists of flatpaks
FLATPAK_LIST=$(flatpak list --columns=application)
Expand Down
24 changes: 24 additions & 0 deletions usr/etc/flatpak/system/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
org.mozilla.firefox
org.freedesktop.Platform.ffmpeg-full//22.08
org.gnome.Calculator
org.gnome.Calendar
org.gnome.Characters
org.gnome.Connections
org.gnome.Contacts
org.gnome.Evince
org.gnome.Loupe
org.gnome.Logs
org.gnome.Maps
org.gnome.NautilusPreviewer
org.gnome.TextEditor
org.gnome.Weather
org.gnome.baobab
org.gnome.clocks
org.gnome.font-viewer
com.mattjakeman.ExtensionManager
com.github.tchx84.Flatseal
io.github.flattool.Warehouse
com.github.marhkb.Pod
org.fedoraproject.MediaWriter
io.missioncenter.MissionCenter
io.github.celluloid_player.Celluloid
24 changes: 0 additions & 24 deletions usr/etc/flatpak/user/install
Original file line number Diff line number Diff line change
@@ -1,24 +0,0 @@
org.mozilla.firefox
org.freedesktop.Platform.ffmpeg-full//22.08
org.gnome.Calculator
org.gnome.Calendar
org.gnome.Characters
org.gnome.Connections
org.gnome.Contacts
org.gnome.Evince
org.gnome.Loupe
org.gnome.Logs
org.gnome.Maps
org.gnome.NautilusPreviewer
org.gnome.TextEditor
org.gnome.Weather
org.gnome.baobab
org.gnome.clocks
org.gnome.font-viewer
com.mattjakeman.ExtensionManager
com.github.tchx84.Flatseal
io.github.flattool.Warehouse
com.github.marhkb.Pods
org.fedoraproject.MediaWriter
io.missioncenter.MissionCenter
io.github.celluloid_player.Celluloid
24 changes: 24 additions & 0 deletions usr/etc/flatpak/user/remove
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
org.mozilla.firefox
org.freedesktop.Platform.ffmpeg-full//22.08
org.gnome.Calculator
org.gnome.Calendar
org.gnome.Characters
org.gnome.Connections
org.gnome.Contacts
org.gnome.Evince
org.gnome.Loupe
org.gnome.Logs
org.gnome.Maps
org.gnome.NautilusPreviewer
org.gnome.TextEditor
org.gnome.Weather
org.gnome.baobab
org.gnome.clocks
org.gnome.font-viewer
com.mattjakeman.ExtensionManager
com.github.tchx84.Flatseal
io.github.flattool.Warehouse
com.github.marhkb.Pod
org.fedoraproject.MediaWriter
io.missioncenter.MissionCenter
io.github.celluloid_player.Celluloid

0 comments on commit 2a509af

Please sign in to comment.