Skip to content

Commit

Permalink
fix(just): make toggle-updates check if ublue-update is installed (#284)
Browse files Browse the repository at this point in the history
* fix(just): make toggle-updates smarter
It will now toggle the auto update services relevant for the system depending on ublue-update being present or not.

* chore: update version number of just.spec

* chore: change if condition for CURRENT_STATE to use systemctl -q flag
  • Loading branch information
HikariKnight authored Jul 24, 2024
1 parent a1c0ec7 commit 4b7aa2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
16 changes: 11 additions & 5 deletions build/ublue-os-just/10-update.just
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ toggle-updates ACTION="prompt":
#!/usr/bin/bash
source /usr/lib/ujust/ujust.sh
CURRENT_STATE="Disabled"
if systemctl is-enabled ublue-update.timer | grep -q enabled; then
if systemctl -q is-enabled ublue-update.timer; then
CURRENT_STATE="Enabled"
elif systemctl -q is-enabled rpm-ostreed-automatic.timer; then
CURRENT_STATE="Enabled"
fi
OPTION={{ ACTION }}
Expand All @@ -104,15 +106,19 @@ toggle-updates ACTION="prompt":
exit 0
fi
if [ "${OPTION,,}" == "enable" ]; then
sudo systemctl enable ublue-update.timer
if systemctl is-enabled flatpak-system-update.timer | grep -q disabled; then
if systemctl is-enabled ublue-update.timer 2> /dev/null | grep -q not-found; then
sudo systemctl enable --now flatpak-system-update.timer rpm-ostreed-automatic.timer
systemctl enable --now --user flatpak-user-update.timer
else
sudo systemctl enable ublue-update.timer
sudo systemctl disable --now flatpak-system-update.timer rpm-ostreed-automatic.timer
systemctl disable --now --user flatpak-user-update.timer
fi
elif [ "${OPTION,,}" == "disable" ]; then
sudo systemctl disable ublue-update.timer
if systemctl is-enabled flatpak-system-update.timer | grep -q enabled; then
if systemctl is-enabled ublue-update.timer 2> /dev/null | grep -q not-found; then
sudo systemctl disable --now flatpak-system-update.timer rpm-ostreed-automatic.timer
systemctl disable --now --user flatpak-user-update.timer
else
sudo systemctl disable ublue-update.timer
fi
fi
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.34
Version: 0.35
Release: 1%{?dist}
Summary: ublue-os just integration
License: MIT
Expand Down Expand Up @@ -109,6 +109,9 @@ just --completions bash | sed -E 's/([\(_" ])just/\1ujust/g' > %{_datadir}/bash-
chmod 644 %{_datadir}/bash-completion/completions/ujust

%changelog
* Fri May 31 2024 HikariKnight <[email protected]> - 0.35
- Make toggle-updates smarter and detect if ublue-update is installed

* Sat May 18 2024 m2Giles <[email protected]> - 0.34
- Fix missing sourcefile for just split out

Expand Down

0 comments on commit 4b7aa2b

Please sign in to comment.