Skip to content

Commit

Permalink
feat: standardize flatpak/rpm-ostree update timers (#84)
Browse files Browse the repository at this point in the history
This adds an override for the Fedora stock rpm-ostreed-automatic.timer
and sets it and both the user and system flatpak timers to always run at
4:00AM localtime. If the host machine is suspended or powered down
  during that time, the timers will execute on next boot. The flatpak
update services have been simplified to not request install and to be
simple services like rpm-ostreed-automatic.service.

Closes #26
  • Loading branch information
bsherman authored Jul 23, 2023
1 parent 41b8d2e commit 64f6b36
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
1 change: 1 addition & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ADD https://codeberg.org/fabiscafe/game-devices-udev/archive/main.tar.gz /tmp/ub
ADD files/etc/udev/rules.d /tmp/ublue-os/udev-rules/etc/udev/rules.d
ADD files/usr/lib/systemd /tmp/ublue-os/update-services/usr/lib/systemd
ADD files/etc/rpm-ostreed.conf /tmp/ublue-os/update-services/etc/rpm-ostreed.conf
ADD files/etc/systemd /tmp/ublue-os/update-services/etc/systemd
ADD files/usr/etc /tmp/ublue-os/signing/usr/etc

RUN tar cf /tmp/ublue-os/rpmbuild/SOURCES/ublue-os-udev-rules.tar.gz -C /tmp ublue-os/udev-rules
Expand Down
10 changes: 10 additions & 0 deletions files/etc/systemd/system/rpm-ostreed-automatic.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=rpm-ostree Automatic Update Trigger
Documentation=man:rpm-ostree(1) man:rpm-ostreed.conf(5)
ConditionPathExists=/run/ostree-booted

[Timer]
OnCalendar=*-*-* 4:00:00

[Install]
WantedBy=timers.target
7 changes: 2 additions & 5 deletions files/usr/lib/systemd/system/flatpak-system-update.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/bin/flatpak --system update -y --noninteractive

[Install]
WantedBy=multi-user.target
Type=simple
ExecStart=/usr/bin/flatpak --system update -y --noninteractive
3 changes: 1 addition & 2 deletions files/usr/lib/systemd/system/flatpak-system-update.timer
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Description=Flatpak Automatic Update Trigger
Documentation=man:flatpak(1)

[Timer]
OnBootSec=5m
OnCalendar=0/6:00:00
OnCalendar=*-*-* 4:00:00
Persistent=true

[Install]
Expand Down
5 changes: 1 addition & 4 deletions files/usr/lib/systemd/user/flatpak-user-update.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
Type=simple
ExecStart=/usr/bin/flatpak --user update -y --noninteractive

[Install]
WantedBy=multi-user.target
3 changes: 1 addition & 2 deletions files/usr/lib/systemd/user/flatpak-user-update.timer
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Description=Flatpak Automatic Update Trigger
Documentation=man:flatpak(1)

[Timer]
OnBootSec=5m
OnCalendar=0/6:00:00
OnCalendar=*-*-* 4:00:00
Persistent=true

[Install]
Expand Down
7 changes: 6 additions & 1 deletion rpmspec/ublue-os-update-services.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: ublue-os-update-services
Packager: ublue-os
Vendor: ublue-os
Version: 0.4
Version: 0.5
Release: 1%{?dist}
Summary: Automatic updates for rpm-ostree and flatpak
License: MIT
Expand Down Expand Up @@ -51,15 +51,20 @@ tar xf %{SOURCE0} -C %{buildroot} --strip-components=2 --exclude etc/rpm-ostreed
%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/%{_exec_prefix}/lib/systemd/user/flatpak-user-update.service
%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/%{_exec_prefix}/lib/systemd/user/flatpak-user-update.timer
%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/%{_sysconfdir}/rpm-ostreed.conf
%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/%{_sysconfdir}/systemd/system/rpm-ostreed-automatic.timer
%attr(0644,root,root) %{_exec_prefix}/lib/systemd/system-preset/10-flatpak-system-update.preset
%attr(0644,root,root) %{_exec_prefix}/lib/systemd/system/flatpak-system-update.service
%attr(0644,root,root) %{_exec_prefix}/lib/systemd/system/flatpak-system-update.timer
%attr(0644,root,root) %{_exec_prefix}/lib/systemd/user-preset/10-flatpak-user-update.preset
%attr(0644,root,root) %{_exec_prefix}/lib/systemd/user/flatpak-user-update.service
%attr(0644,root,root) %{_exec_prefix}/lib/systemd/user/flatpak-user-update.timer
%attr(0644,root,root) %{_sysconfdir}/systemd/system/rpm-ostreed-automatic.timer


%changelog
* Sat Jul 22 2023 Benjamin Sherman <[email protected]> - 0.5
- Set flatpak and rpm-ostree upgrade timers to run daily at 4am local time

* Fri Jun 30 2023 gerblesh <[email protected]> - 0.4
- Add BuildRequires for rpm-systemd-macros to fix enabling systemd services and uninstalling the RPM

Expand Down

0 comments on commit 64f6b36

Please sign in to comment.