I can find the version OS that's installed on my Pi 4. But how can I find out the official current version? Preferably in a way that can be scripted.
What I would love to do would be to write a script that would determine the version OS installed on my Pi (easy), then get the current official version (unknown), compare the two, and send myself an email if they differ. I would then schedule this in cron to run once a month.
Then, I wouldn't have to remember to check it manually. (When done manually I alternate between checking every couple of days, and checking once a year or so.)
Then, when I get an email that I'm out of date, I set aside some time to do the upgrade, and more importantly validating that the upgrade didn't break anything.
EDIT: I'm talking about major release levels, ie Stretch -> Buster-> Bullseye -> Trixie
apt update
followed by anapt list --upgradable
- more than one line in the latter means something can be upgraded (actually the output ofapt update
would tell you that there are upgrades available so the apt list is not really required, but is easier to parse to check if upgrades are available)