agama/live/live-root/usr/bin/agama-self-update
Ladislav Slezák 655882fa54
Rename "root" to "live-root" to avoid confusion
...with "root/root".
2025-04-23 13:26:35 +02:00

31 lines
950 B
Bash
Executable file

#! /bin/sh
# Experimental Agama self-update script
#
# This script updates the Agama packages in the Live system from the
# Agama Devel OBS project.
# check if self-update is required
if ! grep -q "\b\(inst\|agama\)\.self_update=1\b" /run/agama/cmdline.d/agama.conf; then
exit 0
fi
# first try a quick and simple solution, refreshing the distributions repository takes a
# lot of time so try using only the agama-devel for update
zypper modifyrepo --disable --all
zypper modifyrepo --enable agama-devel
zypper refresh
zypper --non-interactive dup --details --from agama-devel
STATUS=$?
# enable all repositories back
zypper modifyrepo --enable --all
# if it failed try it again with all the repos enabled, maybe there was some
# dependency problem which hopefully will be OK now
if [ "$?" != "0" ]; then
zypper --non-interactive dup --details --from agama-devel
fi
# clean all repository caches to save space in RAM disk
zypper clean --all