fix(default-flatpaks): Missing notification for system flatpaks (#87)

* fix:(default-flatpaks): Missing notification for system flatpaks

This approach, while more fragmented, it's cleaner, as there is a clearer separation of root & non-root operations done by flatpak-setup service. This should probably increase security too (but I'm not the expert to talk seriously about that). It also gets rid of some non-harming error for /var data, can't remember it fully.

While it may be confusing for users that they have to type:

`systemctl status --user system-flatpak-setup`

instead of previous:

`systemctl status system-flatpak-setup`

It is something worth sacrificing for the important user-experience fix.
This commit is contained in:
fiftydinar 2023-12-27 10:12:49 +01:00 committed by GitHub
parent f75eddd56c
commit ec020cd2ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 69 additions and 45 deletions

View file

@ -6,15 +6,17 @@ Flatpaks can either be installed system-wide or per-user, though per-user flatpa
The module uses the following scripts to handle flatpak setup:
- `/usr/bin/system-flatpak-presetup`
- `/usr/bin/system-flatpak-setup`
- `/usr/bin/user-flatpak-setup`
The scripts are run on every boot by these services:
- `/usr/lib/systemd/system/system-flatpak-presetup.service`
- `/usr/lib/systemd/system/system-flatpak-setup.service`
- `/usr/lib/systemd/user/user-flatpak-setup-service`
`system-flatpak-setup` checks the flatpak repo information and install/remove lists created by the module. `user-flatpak-setup` functions the same for user flatpaks.
`system-flatpak-presetup` uninstalls Fedora flatpaks & replaces Fedora repos with your system repos (needs root, hence why it's presetup). `system-flatpak-setup` checks the flatpak install/remove lists created by the module & performs the install/uninstall operation according to that. `user-flatpak-setup` functions the same for user flatpaks, with additional "user" replacement repo operation.
This module stores the Flatpak remote configuration and Flatpak install/remove lists in `/etc/flatpak/`. There are two subdirectories, `user` and `system` corresponding with the install level of the Flatpaks and repositories. Each directory has text files containing the IDs of flatpaks to `install` and `remove`, plus a `repo-info.yml` containing the details of the Flatpak repository.
@ -32,6 +34,7 @@ system:
repo-title: "Flathub (system-wide)" # Optional; this sets the remote's user-facing name in graphical frontends like GNOME Software
install:
- org.gnome.Loupe
- org.winehq.Wine//stable-23.08 # This is an example of flatpak which has multiple versions in selection (flatpak//version)
remove:
- org.gnome.eog
# A flatpak repo can also be added without having to install flatpaks,

View file

@ -5,9 +5,11 @@ set -oue pipefail
BLING_DIRECTORY="${BLING_DIRECTORY:-"/tmp/bling"}"
cp -r "$BLING_DIRECTORY"/files/usr/bin/system-flatpak-presetup /usr/bin/system-flatpak-presetup
cp -r "$BLING_DIRECTORY"/files/usr/bin/system-flatpak-setup /usr/bin/system-flatpak-setup
cp -r "$BLING_DIRECTORY"/files/usr/bin/user-flatpak-setup /usr/bin/user-flatpak-setup
cp -r "$BLING_DIRECTORY"/files/usr/lib/systemd/system/system-flatpak-setup.service /usr/lib/systemd/system/system-flatpak-setup.service
cp -r "$BLING_DIRECTORY"/files/usr/lib/systemd/system/system-flatpak-presetup.service /usr/lib/systemd/system/system-flatpak-presetup.service
cp -r "$BLING_DIRECTORY"/files/usr/lib/systemd/user/system-flatpak-setup.service /usr/lib/systemd/user/system-flatpak-setup.service
cp -r "$BLING_DIRECTORY"/files/usr/lib/systemd/user/user-flatpak-setup.service /usr/lib/systemd/user/user-flatpak-setup.service
configure_flatpak_repo () {
@ -104,7 +106,8 @@ configure_lists () {
echo "Enabling flatpaks module"
mkdir -p /usr/etc/flatpak/{system,user}
systemctl enable -f system-flatpak-setup.service
systemctl enable -f system-flatpak-presetup.service
systemctl enable -f --global system-flatpak-setup.service
systemctl enable -f --global user-flatpak-setup.service
# Check that `system` is present before configuring