apatel762 / home-infra

A repository containing all of the setup for my home infra (e.g. my laptop & soon, my server)
GNU Affero General Public License v3.0
0 stars 0 forks source link

Chromium web apps disappear when the browser is updated by Flatpak #98

Open apatel762 opened 1 year ago

apatel762 commented 1 year ago

After an update, if you run:

ls -al ~/.local/share/flatpak/app/com.brave.Browser/current/active/files/share/

...you'll see that the policy folders are gone.

apatel762 commented 1 year ago

The workaround is to just re-run the playbook and it will put the policy back into the folder where it's meant to be.

apatel762 commented 1 year ago

The workaround will become easier when #99 is done.

apatel762 commented 1 year ago

Maybe could create a systemd timer that runs after Flatpak updates are done. The systemd timer would trigger a unit which runs the "configure brave browser" role (which will re-apply the policies and forcibly re-install the web apps)

We could guard it by adding a check that makes sure that it only runs if the policy folder is gone (if the policy folder is gone, we know that there's been an update to the app)

apatel762 commented 1 year ago

After looking into things a bit further, I think this could be make to work by creating a user-level systemd unit that's triggered on boot, and will simply wait until rpm-ostree is available before running whatever configuration plays that we need.

This should work because the Flatpak updates (triggered by unit:app-gnome-org.gnome.Software-2020.scope or similar) acquire a lock on rpm-ostree; waiting for the lock to be released should be a good enough indicator that the updates have been installed.

I verified this by checking the system logs:

# check logs since last boot
journalctl -b 0

when the pager opens, type /gnome-software to find the instances of gnome-software doing stuff on boot. You should see something like the below log line, which shows gnome-software registering with rpm-ostree.

rpm-ostree[2285]: client(id:gnome-software dbus:1.108 ... uid:1000) added; new total=1

...and then, some time later, you should see the below log line, which shows gnome-software releasing its lock on rpm-ostree - this is when our script should start running updates.

rpm-ostree[2285]: client(id:gnome-software dbus:1.108 ... uid:1000) vanished; remaining=0