Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

feat: move system Flatpak handling out of Yafti #88

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ RUN /tmp/build.sh && \
mkdir -p /tmp/inter /usr/share/fonts/inter && \
unzip /tmp/inter.zip -d /tmp/inter/ && \
mv /tmp/inter/*.ttf /tmp/inter/*.ttc /tmp/inter/LICENSE.txt /usr/share/fonts/inter/ && \
cat etc/flatpak/install | while read line; do flatpak install --system --noninteractive --no-deploy flathub $line; done && \
systemctl unmask flatpak-system-install.service && \
systemctl enable flatpak-system-install.service && \
systemctl unmask dconf-update.service && \
systemctl enable dconf-update.service && \
systemctl enable rpm-ostree-countme.service && \
Expand Down
16 changes: 16 additions & 0 deletions etc/flatpak/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
org.gnome.Calculator
org.gnome.Calendar
org.gnome.Characters
org.gnome.clocks
org.gnome.Contacts
org.gnome.Epiphany
org.gnome.Evince
org.gnome.font-viewer
org.gnome.Loupe
org.gnome.Maps
org.gnome.Music
org.gnome.NautilusPreviewer
org.gnome.Snapshot
org.gnome.TextEditor
org.gnome.Totem
org.gnome.Weather
8 changes: 8 additions & 0 deletions etc/flatpak/remotes.d/flathub.flatpakrepo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Flatpak Repo]
Copy link
Member

@EyeCantCU EyeCantCU Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - can the repo be added via adding:

flatpak remote-add --system --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-modify --system flathub --no-filter --title="Flathub (System)"

To the Containerfile? Love this idea by the way

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes to the first command.
Not tried the second

Copy link
Member

@EyeCantCU EyeCantCU Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Went ahead and gave it a shot, and this ran without failure (the script gets read from my recipe and called in the build script called by the Containerfile): EyeCantCU/Atlas@1328112 (the title of this commit is misleading, I was in a hurry and amended the prior commit)

Throwing this into my Containerfile also seems to have worked:

RUN flatpak remote-add --system --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo && \
    flatpak remote-modify --system flathub --no-filter --title="Flathub (System)"

Either way, it's awesome to hear the remote can at least be added that way

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see why manually including this is needed now. My instructions above only work for the build process. The remote never gets added to the users system the way I set it up

Title=Flathub
Url=https://dl.flathub.org/repo/
Homepage=https://flathub.org/
Comment=Central repository of Flatpak applications
Description=Central repository of Flatpak applications
Icon=https://dl.flathub.org/repo/logo.svg
GPGKey=mQINBFlD2sABEADsiUZUOYBg1UdDaWkEdJYkTSZD68214m8Q1fbrP5AptaUfCl8KYKFMNoAJRBXn9FbE6q6VBzghHXj/rSnA8WPnkbaEWR7xltOqzB1yHpCQ1l8xSfH5N02DMUBSRtD/rOYsBKbaJcOgW0K21sX+BecMY/AI2yADvCJEjhVKrjR9yfRX+NQEhDcbXUFRGt9ZT+TI5yT4xcwbvvTu7aFUR/dH7+wjrQ7lzoGlZGFFrQXSs2WI0WaYHWDeCwymtohXryF8lcWQkhH8UhfNJVBJFgCY8Q6UHkZG0FxMu8xnIDBMjBmSZKwKQn0nwzwM2afskZEnmNPYDI8nuNsSZBZSAw+ThhkdCZHZZRwzmjzyRuLLVFpOj3XryXwZcSefNMPDkZAuWWzPYjxS80cm2hG1WfqrG0Gl8+iX69cbQchb7gbEb0RtqNskTo9DDmO0bNKNnMbzmIJ3/rTbSahKSwtewklqSP/01o0WKZiy+n/RAkUKOFBprj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o73bY4XagbnCqve6PvQb5G2Z55qhWphd6f4B6DGed86zJEa/RhS
10 changes: 10 additions & 0 deletions etc/systemd/system/flatpak-system-install.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Install System Flatpak on boot
Documentation=https://github.com/ublue-os/endlish-oesque/issues/10

[Service]
Type=oneshot
ExecStart=/usr/bin/ublue-flatpak-system-install

[Install]
WantedBy=multi-user.target
67 changes: 0 additions & 67 deletions etc/yafti.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ screens:
- run: /usr/lib/fedora-third-party/fedora-third-party-opt-out
- run: /usr/bin/fedora-third-party disable
- run: flatpak remote-delete fedora --force
- run: flatpak remove --system --noninteractive --all
Copy link
Member

@p5 p5 Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious - how do you plan to remove the pre-installed Fedora Flatpaks when rebasing from an existing Silverblue install? Wouldn't you end up with duplicate flatpaks from different remotes?
Or are you assuming this will be installed via ISOs - therefore not contain existing Flatpaks?

Perhaps this flatpak remove step is best added to the systemd oneshot service? Bad idea

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p5 yeah I wondered about this as well; doesn't the line immediately above handle that?

But it should definitely be tested. I didn't remove this line in endlish-oesque (https://github.com/ublue-os/endlish-oesque/blob/36f22545c9e1cac3cafb45848fb022067b21c9a1/etc/yafti.yml#L20-L26) and I recall some issues with the system remote being removed and re-added unnecessarily.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could copy this back into endlish-oesque and just see what happens when rebasing from a stock Fedora image, as it's an even more experimental image and I don't mind pushing broken things there. 😄

Copy link
Member

@p5 p5 Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to update your script to add logic to remove Fedora flatpaks if the oneshot hasn't been ran already. Will let you know if it works
https://github.com/rsturla/eternal-images/pull/21/files#diff-cac88664baf2bb1d4c843b4247ea9ab0ccaa0b13b00cf55a5c63768f0f4dd97eR1

doesn't the line immediately above handle that?

I believe the line you're referring to only removes the remote, so you no longer get updates from the Fedora repos and cannot install new Fedora flatpaks. I don't think it deletes any of the packages. I may be wrong though, so don't blindly take my word for it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p5 ah you're right; I wasn't aware a Flatpak could get orphaned like that. I'll poke around a bit with the Flatpak CLI and docs. 😄

Copy link
Collaborator Author

@cassidyjames cassidyjames Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean rather than removing all, I could just specifically target the Fedora remote. Duh! 🤦🏻

Flatpak has limited CLI when it comes to removing apps from a specific remote as opposed to a specific installation. Hrm.

Copy link
Member

@p5 p5 Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this method of installing Flatpaks been confirmed in Silverblue OCI images?
It looks like files are stored in /var/lib/, which is not allowed by ostree.

98.73 Found file: var/lib/flatpak/repo/objects/4b/54aceab94ad094bbc1154f2f160a77b27c3f339caf57c1cfb7da33b9ce534d.file
98.73 Found file: var/lib/flatpak/repo/objects/4b/b51a1d2fb4dbb5eda84f52cd47862efbb4c62f03d27512e3f6c66c3df8c0de.file
98.91 error: Found content in var

It looks like you're clearing out that directory at the end of your layer, but that cannot happen if the cache/artefacts are stored in that directory.

Where does Flatpak store the artefacts from --no-deploy?

Copy link
Member

@p5 p5 Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, you can change the cache directory using the following environment variable

FLATPAK_SYSTEM_CACHE_DIR

https://docs.flatpak.org/en/latest/flatpak-command-reference.html#Environment

We will likely need to set that to somewhere else since it defaults to /var/tmp, which must be clear when running ostree container commit.

Note: This is only required if --no-deploy stores the files in /var/, which I'm not sure about

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be fine to add this line to the Containerfile (or a script called by it) so that they get removed while the image is built

- run: flatpak remote-add --system --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- run: flatpak remote-modify --system flathub --no-filter --title="Flathub (System)"
- run: flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
applications:
source: yafti.screen.package
Expand All @@ -36,70 +33,6 @@ screens:
description: GNOME Apps
default: true
packages:
- Calculator:
package: org.gnome.Calculator
system: true
user: false
- Calendar:
package: org.gnome.Calendar
system: true
user: false
- Characters:
package: org.gnome.Characters
system: true
user: false
- Clocks:
package: org.gnome.clocks
system: true
user: false
- Contacts:
package: org.gnome.Contacts
system: true
user: false
- Document Viewer:
package: org.gnome.Evince
system: true
user: false
- Fonts:
package: org.gnome.font-viewer
system: true
user: false
- Loupe:
package: org.gnome.Loupe
system: true
user: false
- Maps:
package: org.gnome.Maps
system: true
user: false
- Music:
package: org.gnome.Music
system: true
user: false
- Nautilus Preview:
package: org.gnome.NautilusPreviewer
system: true
user: false
- Snapshot:
package: org.gnome.Snapshot
system: true
user: false
- Text Editor:
package: org.gnome.TextEditor
system: true
user: false
- Videos:
package: org.gnome.Totem
system: true
user: false
- Weather:
package: org.gnome.Weather
system: true
user: false
- Web:
package: org.gnome.Epiphany
system: true
user: false
Utilities:
description: Potentially useful apps for advanced users
default: false
Expand Down
5 changes: 5 additions & 0 deletions usr/bin/ublue-flatpak-system-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

cat /etc/flatpaks | while read line; do
flatpak install --system --noninteractive --no-pull flathub $line
done && mv /etc/flatpak/install /etc/flatpak/installed
Loading