chore: Improve LACT updater

This commit is contained in:
Kyle Gospodnetich 2024-07-28 16:16:53 -07:00
parent ee163e5737
commit 9dd8ebf10d

View File

@ -8,24 +8,27 @@ echo "Looking for updates..."
if [[ $(rpm -qa | grep lact) ]]; then
LACT_VERSION=$(curl -s https://api.github.com/repos/ilya-zlobintsev/LACT/releases/latest | jq -r '.tag_name | ltrimstr("v")')
if [[ ! $(rpm-ostree status | grep lact | grep $LACT_VERSION) ]]; then
if [[ ! $(rpm-ostree status --booted | grep lact | grep $LACT_VERSION) ]]; then
# This will check if *any* rpm-ostree pin has the newest version, so we don't update needlessly if a user just needs to reboot or is trying an older pin.
echo "Found upstream version v$LACT_VERSION, updating..."
ublue-update --wait
if [[ ${BASE_IMAGE_NAME} == 'silverblue' ]]; then
echo 'Installing LACT Libadwaita...'
wget \
$(curl -s https://api.github.com/repos/ilya-zlobintsev/LACT/releases/latest | \
jq -r ".assets[] | select(.name | test(\"lact-libadwaita.*fedora-$(rpm -E %fedora)\")) | .browser_download_url") \
-O /tmp/lact.rpm
else
PACKAGE="lact"
if [[ ${BASE_IMAGE_NAME} == 'kinoite' ]]; then
echo 'Installing LACT...'
wget \
$(curl -s https://api.github.com/repos/ilya-zlobintsev/LACT/releases/latest | \
jq -r ".assets[] | select(.name | test(\"lact-[0-9].*fedora-$(rpm -E %fedora)\")) | .browser_download_url") \
-O /tmp/lact.rpm
else
echo 'Installing LACT Libadwaita...'
wget \
$(curl -s https://api.github.com/repos/ilya-zlobintsev/LACT/releases/latest | \
jq -r ".assets[] | select(.name | test(\"lact-libadwaita.*fedora-$(rpm -E %fedora)\")) | .browser_download_url") \
-O /tmp/lact.rpm
PACKAGE="lact-libadwaita"
fi
rpm-ostree override replace /tmp/lact.rpm
rpm-ostree remove "$PACKAGE"
rpm-ostree install /tmp/lact.rpm
echo "Update complete"
fi
else