From 7c73bf9b1ab2597d2126d3d090d77f4c783eb2d5 Mon Sep 17 00:00:00 2001 From: "Jorge O. Castro" Date: Wed, 22 Feb 2023 16:36:54 -0500 Subject: [PATCH 1/2] feat: split flatpak update units into user and system --- Containerfile | 4 +++- usr/lib/systemd/system/flatpak-system-update.service | 12 ++++++++++++ .../lib/systemd/system/flatpak-system-update.timer | 4 ++-- .../lib/systemd/user/flatpak-user-update.service | 4 ++-- usr/lib/systemd/user/flatpak-user-update.timer | 11 +++++++++++ 5 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 usr/lib/systemd/system/flatpak-system-update.service rename etc/systemd/system/flatpak-automatic.timer => usr/lib/systemd/system/flatpak-system-update.timer (60%) rename etc/systemd/system/flatpak-automatic.service => usr/lib/systemd/user/flatpak-user-update.service (61%) create mode 100644 usr/lib/systemd/user/flatpak-user-update.timer diff --git a/Containerfile b/Containerfile index beab041375..5644e046ab 100644 --- a/Containerfile +++ b/Containerfile @@ -9,6 +9,7 @@ FROM quay.io/fedora-ostree-desktops/silverblue:${FEDORA_MAJOR_VERSION} RUN wget https://copr.fedorainfracloud.org/coprs/ublue-os/vanilla-first-setup/repo/fedora-$(rpm -E %fedora)/ublue-os-vanilla-first-setup-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_ublue-os-vanilla-first-setup.repo COPY etc /etc +COPY usr /usr COPY ublue-firstboot /usr/bin @@ -16,7 +17,8 @@ RUN rpm-ostree override remove firefox firefox-langpacks && \ rpm-ostree install distrobox gnome-tweaks just vte291-gtk4-devel vanilla-first-setup && \ sed -i 's/#AutomaticUpdatePolicy.*/AutomaticUpdatePolicy=stage/' /etc/rpm-ostreed.conf && \ systemctl enable rpm-ostreed-automatic.timer && \ - systemctl enable flatpak-automatic.timer && \ + systemctl enable flatpak-system-update.timer && \ + systemctl enable flatpak-user-update.timer && \ sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_ublue-os-vanilla-first-setup.repo && \ rm -rf \ /tmp/* \ diff --git a/usr/lib/systemd/system/flatpak-system-update.service b/usr/lib/systemd/system/flatpak-system-update.service new file mode 100644 index 0000000000..c9fd661060 --- /dev/null +++ b/usr/lib/systemd/system/flatpak-system-update.service @@ -0,0 +1,12 @@ +[Unit] +Description=Flatpak Automatic Update +Documentation=man:flatpak(1) +Wants=network-online.target +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/flatpak --system update -y --noninteractive + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/etc/systemd/system/flatpak-automatic.timer b/usr/lib/systemd/system/flatpak-system-update.timer similarity index 60% rename from etc/systemd/system/flatpak-automatic.timer rename to usr/lib/systemd/system/flatpak-system-update.timer index 108b9976a8..fed0adb97b 100644 --- a/etc/systemd/system/flatpak-automatic.timer +++ b/usr/lib/systemd/system/flatpak-system-update.timer @@ -1,5 +1,5 @@ [Unit] -Description=flatpak Automatic Update Trigger +Description=Flatpak Automatic Update Trigger Documentation=man:flatpak(1) [Timer] @@ -8,4 +8,4 @@ OnCalendar=0/6:00:00 Persistent=true [Install] -WantedBy=timers.target +WantedBy=timers.target \ No newline at end of file diff --git a/etc/systemd/system/flatpak-automatic.service b/usr/lib/systemd/user/flatpak-user-update.service similarity index 61% rename from etc/systemd/system/flatpak-automatic.service rename to usr/lib/systemd/user/flatpak-user-update.service index 140f6f5982..a2f0faeeb4 100644 --- a/etc/systemd/system/flatpak-automatic.service +++ b/usr/lib/systemd/user/flatpak-user-update.service @@ -1,12 +1,12 @@ [Unit] -Description=flatpak Automatic Update +Description=Flatpak Automatic Update Documentation=man:flatpak(1) Wants=network-online.target After=network-online.target [Service] Type=oneshot -ExecStart=/usr/bin/flatpak update -y +ExecStart=/usr/bin/flatpak --user update -y --noninteractive [Install] WantedBy=multi-user.target diff --git a/usr/lib/systemd/user/flatpak-user-update.timer b/usr/lib/systemd/user/flatpak-user-update.timer new file mode 100644 index 0000000000..fed0adb97b --- /dev/null +++ b/usr/lib/systemd/user/flatpak-user-update.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Flatpak Automatic Update Trigger +Documentation=man:flatpak(1) + +[Timer] +OnBootSec=5m +OnCalendar=0/6:00:00 +Persistent=true + +[Install] +WantedBy=timers.target \ No newline at end of file From ac81ecc3ee6e804fc6103eeb76971b5a5edb0b16 Mon Sep 17 00:00:00 2001 From: "Jorge O. Castro" Date: Wed, 22 Feb 2023 18:15:06 -0500 Subject: [PATCH 2/2] feat: move user update service activation to the first boot script --- Containerfile | 1 - ublue-firstboot | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Containerfile b/Containerfile index 5644e046ab..6a00797743 100644 --- a/Containerfile +++ b/Containerfile @@ -18,7 +18,6 @@ RUN rpm-ostree override remove firefox firefox-langpacks && \ sed -i 's/#AutomaticUpdatePolicy.*/AutomaticUpdatePolicy=stage/' /etc/rpm-ostreed.conf && \ systemctl enable rpm-ostreed-automatic.timer && \ systemctl enable flatpak-system-update.timer && \ - systemctl enable flatpak-user-update.timer && \ sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_ublue-os-vanilla-first-setup.repo && \ rm -rf \ /tmp/* \ diff --git a/ublue-firstboot b/ublue-firstboot index 2b01c2801e..b4f3b15507 100755 --- a/ublue-firstboot +++ b/ublue-firstboot @@ -125,8 +125,18 @@ if [ "$?" != 0 ] ; then --text="Installing Celluloid Failed" exit 1 fi +echo "95" + +echo "Enabling Flatpak auto update" +/usr/bin/systemctl --user enable --now flatpak-user-update.timer +if [ "$?" != 0 ] ; then + zenity --error \ + --text="Setting Flatpak Autoupdate Failed" + exit 1 +fi echo "100" + echo "# Reticulating Final Splines" mkdir -p "$HOME"/.config/ublue/ touch "$HOME"/.config/ublue/firstboot-done @@ -139,4 +149,4 @@ cp -n /etc/justfile "$HOME"/.justfile if [ "$?" != 0 ] ; then zenity --error \ --text="Firstboot Configuration Error" -fi \ No newline at end of file +fi