Merge pull request #25 from ublue-os/updater

feat(steamos-update): Initial support for Universal Blue updater
This commit is contained in:
RJ Trujillo 2023-07-03 21:32:57 -06:00 committed by GitHub
commit cd4b949e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 16 deletions

View File

@ -14,7 +14,8 @@ COPY system_files/desktop/usr /usr
# Add ublue-update
COPY --from=ghcr.io/ublue-os/ublue-update:latest /rpms/ublue-update.noarch.rpm /tmp/rpms/
RUN rpm-ostree install /tmp/rpms/ublue-update.noarch.rpm
RUN rpm-ostree override remove ublue-os-update-services && \
rpm-ostree install /tmp/rpms/ublue-update.noarch.rpm
# Add Copr repos
RUN wget https://copr.fedorainfracloud.org/coprs/kylegospo/bazzite/repo/fedora-$(rpm -E %fedora)/kylegospo-bazzite-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo-bazzite.repo && \
@ -58,7 +59,6 @@ RUN pip install --prefix=/usr yafti && \
sed -i 's/#DefaultTimeoutStopSec.*/DefaultTimeoutStopSec=15s/' /etc/systemd/user.conf && \
sed -i 's/#DefaultTimeoutStopSec.*/DefaultTimeoutStopSec=15s/' /etc/systemd/system.conf && \
systemctl disable rpm-ostreed-automatic.timer && \
systemctl disable flatpak-system-update.timer && \
systemctl --global enable ublue-update.timer && \
systemctl enable input-remapper.service && \
rm -rf \
@ -129,6 +129,7 @@ RUN sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-bazzite.re
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-hl2linux-selinux.repo && \
systemctl enable set-cfs-tweaks.service && \
systemctl disable input-remapper.service && \
systemctl --global disable ublue-update.timer && \
rm -rf \
/tmp/* \
/var/* && \

View File

@ -1,6 +1,6 @@
#!/bin/bash
if command -v rpm-ostree > /dev/null; then
if command -v ublue-update > /dev/null; then
if [ "$1" == "check" ]; then
if [ -f '/tmp/upgrade-installed' ]; then
exit 7 # Upgrade already installed
@ -8,14 +8,12 @@ if command -v rpm-ostree > /dev/null; then
# Perform connectivity check
wget -q --spider https://github.com
if [ $? -eq 0 ]; then
# Compare installation digest to latest image
IMAGE=$(rpm-ostree status | grep -m1 ghcr | sed 's/^.*ghcr/ghcr/')
CURRENT=$(rpm-ostree status | grep -m1 Digest | tr -d '[:space:]' | sed 's/'Digest:'//g')
LATEST=$(skopeo inspect docker://${IMAGE} | jq '.Digest' | tr -d '"')
if [ ${CURRENT} == ${LATEST} ]; then
exit 7 # Up to date
else
# Check system state
ublue-update --check
if [ $? -eq 0 ]; then
exit 0 # Upgrade available
else
exit 7 # Checks failed
fi
else
exit 7 # Connectivity check failed
@ -36,20 +34,20 @@ if command -v rpm-ostree > /dev/null; then
echo 100%
}
upgrade() {
# Pull exit code from rpm-ostree
rpm-ostree upgrade --unchanged-exit-77
# Pull exit code from ublue-update
ublue-update --force
echo $? > /tmp/upgrade-check
}
upgrade | fake_progress
# Check if upgrade failed
UPGRADE_CHECK=/tmp/upgrade-check
rm /tmp/upgrade-check
if [ ${UPGRADE_CHECK} -eq 77 ]; then
exit 0 # Upgrade failed
else
if [ ${UPGRADE_CHECK} -eq 0 ]; then
touch /tmp/upgrade-installed
else
exit 0 # Upgrade failed
fi
fi
else
exit 7 # rpm-ostree not installed
exit 7 # ublue-update not installed
fi