While IncusOS is very actively under development, the frequency of updates is enough that, sometimes, one might wish to skip an update or two. To help in evaluating this, I wrote a little script entirely using my own natural intelligence (or lack there-of).
This will query your default incus system for the current update status / reboot requirements, and then open the GitHub diff / comparison between the current version and the new version. You can then evaluate whether or not the new version is important enough to necessitate a reboot or not.
For example, as I write this I’m running incusos 202602230420 and 202602240349 is now available, necessitating a reboot. But, looking at the comparison the only changes are related to Migration-Manager, which I am not using… so I can reasonably ignore this update.
The code:
#!/usr/bin/zsh
# this code is released into the public domain and is free for anyone to use in anyway at all.
ius=$(incus query incus:/os/1.0/system/update)
if [[ "${1}" == "-l" ]]
then
echo "incus query incus:/os/1.0/system/update\n${ius}"
else
nr=$(echo "$ius" | grep "needs_reboot")
if [[ "$nr" =~ 'false' ]]
then
echo "No reboot needed."
elif [[ "$nr" =~ 'true' ]]
then
aos=$(incus admin os show 2> /dev/null )
currentversion=$(echo "${aos}" | grep 'os_version:' | awk '-F: "' '{print $2}' | awk '-F"' '{print $1}')
newversion=$(echo "${aos}" | grep 'os_version_next:' | awk '-F: "' '{print $2}' | awk '-F"' '{print $1}')
echo "Reboot needed!"
echo "${currentversion} -> ${newversion}"
xdg-open "https://github.com/lxc/incus-os/compare/${currentversion}...${newversion}"
else
echo "Unknown state:\n$ius"
fi
fi
I’m sure there are better way to do this.
I’m using two different API calls and could probably get away with just the “incus admin os show” command as it looks like it has all the necessary information (it doesn’t have a “needs reboot” field, but does show different current/new versions if they’re present, and that probably amounts to the same thing).
If my grep/regex-fu were better, the two pipes to awk could probably be eliminated, but that would require back-references and so would look messier, and might even be slower.
Et Cetera.
The script currently specifies zsh, but I think there’s nothing here incompatible with bash.
The URL is opened with xdg-open, which will probably open your default browser, but if your distro or DE somehow doesn’t support that, well….
I’d rather print the diff on the command line, but I’m far to lazy to put any effort into fingering that out. xdg-open is good enough
This script executes a couple incus api/commands, grep, awk and the (probably) built-in echo commands in addition to xdg-open. These should be safe, but please carefully evaluate whether or not you think you should be running it on your system before you do anything crazy like that.