Skip to content

Commit

Permalink
feat: check metered connection before automatic updates (#123)
Browse files Browse the repository at this point in the history
* feat: check metered connection before automatic updates

* feat: add just commands to disable/enable automatic updates

* docs: add metered connection check

* docs: change version

* docs: add auto-update just commands
  • Loading branch information
ArtikusHG authored Oct 2, 2023
1 parent d9229cd commit 0823567
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
10 changes: 10 additions & 0 deletions build/ublue-os-just/10-update.just
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ update:
rpm-ostree update
flatpak update -y
distrobox upgrade -a

# Disable all auto-update timers
disable-updates:
sudo systemctl disable --now flatpak-system-update.timer rpm-ostreed-automatic.timer
sudo systemctl disable --now --user flatpak-user-update.timer

# Enable all auto-update timers
enable-updates:
sudo systemctl enable --now flatpak-system-update.timer rpm-ostreed-automatic.timer
sudo systemctl enable --now --user flatpak-user-update.timer
5 changes: 4 additions & 1 deletion build/ublue-os-just/ublue-os-just.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: ublue-os-just
Packager: ublue-os
Vendor: ublue-os
Version: 0.4
Version: 0.6
Release: 1%{?dist}
Summary: ublue-os just integration
License: MIT
Expand Down Expand Up @@ -45,6 +45,9 @@ done
%attr(0644,root,root) %{_datadir}/%{VENDOR}/justfile

%changelog
* Mon Oct 2 2023 ArtikusHG <[email protected]> - 0.6
- Add commands to disable and enable automatic updates to 60-updates.just

* Sat Sep 23 2023 Kyle Gospodnetich <[email protected]> - 0.5
- Remove fish shell support

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[Unit]
Wants=network-online.target
After=network-online.target

[Service]
ExecCondition=/bin/bash -c '[[ "$(busctl get-property org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager Metered | cut -c 3-)" == @(2|4) ]]'
1 change: 1 addition & 0 deletions files/usr/lib/systemd/system/flatpak-system-update.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ After=network-online.target

[Service]
Type=oneshot
ExecCondition=/bin/bash -c '[[ "$(busctl get-property org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager Metered | cut -c 3-)" == @(2|4) ]]'
ExecStart=/usr/bin/flatpak --system uninstall --unused -y --noninteractive ; /usr/bin/flatpak --system update -y --noninteractive ; /usr/bin/flatpak --system repair
1 change: 1 addition & 0 deletions files/usr/lib/systemd/user/flatpak-user-update.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ After=network-online.target

[Service]
Type=oneshot
ExecCondition=/bin/bash -c '[[ "$(busctl get-property org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager Metered | cut -c 3-)" == @(2|4) ]]'
ExecStart=/usr/bin/flatpak --user uninstall --unused -y --noninteractive ; /usr/bin/flatpak --user update -y --noninteractive ; /usr/bin/flatpak --user repair
5 changes: 4 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.7
Version: 0.8
Release: 1%{?dist}
Summary: Automatic updates for rpm-ostree and flatpak
License: MIT
Expand Down Expand Up @@ -65,6 +65,9 @@ tar xf %{SOURCE0} -C %{buildroot} --strip-components=2 --exclude etc/rpm-ostreed


%changelog
* Mon Oct 2 2023 ArtikusHG <[email protected]> - 0.8
- Add metered connection check to system and flatpak update services

* Sat Aug 12 2023 Benjamin Sherman <[email protected]> - 0.7
- Add randmized delay to update timers, and always run flatpak updates on boot

Expand Down

0 comments on commit 0823567

Please sign in to comment.