On 2022-08-20 19:27, Chuck Zmudzinski wrote:
On 8/20/2022 3:48 PM, John Boxall wrote:
I created an upgrade script based on something I found a few years ago
that indicated the steps to follow to upgrade from one version of Debian
to another (e.g. Buster 10 to Bullseye 11). As I am going to need to run
this script at some point (I am still running Buster/10 on my systems),
I thought I'd ask the Debian user brain trust to comment/critique the
scripted steps. So here they are:
############### Start
apt -y install aptitude
aptitude search \'~o\'
apt update
apt -y upgrade
apt -y full-upgrade
dpkg -C
apt-mark showhold
#
Update sources.list
#
Update files in sources.list.d
(I don't even have this part started yet....didn't know I needed it the
last time I ran it)
#
apt-get check
apt update
apt list --upgradable
apt-get check
apt -y upgrade
apt -y full-upgrade
aptitude search \'~o\'
############### End
Thoughts/critique/criticism/flames/etc
Hi John, here are my suggestions:
You can use apt, apt-get, or aptitude to run the commands that do most of the
work, and in your script you chose apt for that task. I recall reading that
they do not all use the same algorithm to determine which packages to upgrade
and in what order, at each stage of the upgrade. I think I read somewhere that
aptitude has the best algorithm, but apt-get is more suitable for a script. I
don't remember if there are advantages or disadvantages to using apt. So you
should do a little research to try to find the most up-to-date information
about the pros and cons of the different apt related tools. The Debian wiki has
a page on that, I think. Also, you might want to make sure you record the
upgrade session in a logfile so you can examine what the script actually did in
case there are problems. And of course, backup or take a snapshot beforehand so
you can restore the system back to a working state in case things get broken
badly.
HTH,
Chuck
Thanks Chuck, very good points.
apt always tells you that it isn't reliable in a script, which I am
aware of, however, I'll check the wiki. I "think" that applies to
apt-get as well. I've never used aptitude for anything but the one
command (it was one of those recommended on the web page I saw), but
will investigate it further.
I use "tee" extensively in the script and record all of the command output.
As for a backup, I will be cloning the drive to a backup and performing
a test update to that drive first.
My only real concern is the non-Debian software that I've installed over
the years. We'll see how it goes.
--
Regards,
John Boxall