feat: add flatpak install service

This commit is contained in:
Bastien Riviere 2024-05-05 12:27:56 +02:00
parent 28b7fab81c
commit a6cc2ebc7e
Signed by: babariviere
GPG key ID: 4E5F0839249F162E
5 changed files with 52 additions and 0 deletions

View file

@ -58,6 +58,7 @@ COPY --from=ghcr.io/ublue-os/config:latest /files/ublue-os-update-services /
COPY files /
COPY build.sh /tmp/build.sh
COPY packages /tmp/packages
COPY build /tmp/build
RUN mkdir -p /var/lib/alternatives && \
/tmp/build.sh && \

View file

@ -25,7 +25,14 @@ rpm-ostree override remove opensc
# this would install a package from rpmfusion
# rpm-ostree install vlc
### Setup flatpaks
mkdir -p /etc/azure/flatpaks
cp /tmp/build/flatpak-setup /usr/bin/flatpak-setup
cp /tmp/build/flatpak-setup.service /usr/lib/systemd/user/flatpak-setup.service
#### Services
systemctl enable podman.socket
systemctl enable tailscaled.service
systemctl enable -f --global flatpak-setup.service

25
build/flatpak-setup Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Installed flatpaks
FLATPAK_LIST=$(flatpak list --user --app --columns=application)
# Flatpak list files
INSTALL_LIST_FILE="/usr/share/azure/flatpaks/install"
USER_INSTALL_LIST_FILE="/etc/azure/flatpaks/install"
# Prefer user's install + remove list over maintainer's, in case when same flatpak ID is present in maintainer's install list + user's remove list & vice-versa
# Also ignores words starting with # symbol, whitelines & duplicate entries
MAINTAINER_INSTALL_LIST=$(sort "$INSTALL_LIST_FILE" | grep -v -E '^#|^$' | awk '!seen[$0]++')
# Combine maintainer & user list. Ignore words starting with # symbol, whitelines & duplicate entries
COMBINED_INSTALL_LIST=$(cat <(echo "$MAINTAINER_INSTALL_LIST") "$USER_INSTALL_LIST_FILE" | grep -v -E '^#|^$' | awk '!seen[$0]++')
# Install flatpaks in list
if [[ -f $INSTALL_LIST_FILE ]] || [[ -f $USER_INSTALL_LIST_FILE ]]; then
if [[ -n $FLATPAK_LIST ]]; then
INSTALL_LIST=$(comm -23 <(echo "$COMBINED_INSTALL_LIST" | sort) <(echo "$FLATPAK_LIST" | sort))
else
INSTALL_LIST="$COMBINED_INSTALL_LIST"
fi
notify-send "Flatpak Installer" "Started install of user flatpaks" --app-name="Flatpak Installer" -u NORMAL
flatpak install --user --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]}
notify-send "Flatpak Installer" "Finished install of user flatpaks:\n$INSTALL_LIST" --app-name="Flatpak Installer" -u NORMAL
fi

View file

@ -0,0 +1,14 @@
[Unit]
Description=Configure Flatpaks for current user
Wants=network-online.target
After=network-online.service
[Service]
Type=simple
ExecStart=/usr/bin/flatpak-setup
Restart=on-failure
RestartSec=30
StartLimitInterval=0
[Install]
WantedBy=default.target

View file

@ -0,0 +1,5 @@
app/com.github.tchx84.Flatseal/x86_64/stable
app/org.mozilla.firefox/x86_64/stable
app/io.github.dvlv.boxbuddyrs/x86_64/stable
app/com.discordapp.Discord/stable
https://downloads.1password.com/linux/flatpak/1Password.flatpakref