Attempt to run dnf update before the migration (#58)

* Attempt to run dnf update before the migration.

While a migration will generally work without first running dnf update, thera
are several advantages of attempting to run an update first:

* We catch corner cases that an update will solve.

* Since we're running a distro-sync at the end, it effectively updates anyways
  and the same things that will break a distro-sync will often times break an
  update.  By attempting to run the update first we will discover those
  breakages before we put the system into an unstable state and we can bail out
  if the update fails, preventing a potentially disastrous outcome.
This commit is contained in:
Peter Ajamian 2021-06-29 21:21:33 +12:00 committed by GitHub
parent 898ad7f3ea
commit ac6fbedc21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -560,6 +560,14 @@ generate_rpm_info() {
rpm -Va | sort -k3 > "${convert_info_dir}/$HOSTNAME-rpm-list-verified-$1.log" rpm -Va | sort -k3 > "${convert_info_dir}/$HOSTNAME-rpm-list-verified-$1.log"
} }
# Run a dnf update before the actual migration.
pre_update() {
infomsg '%s\n' "Running dnf update before we attempt the migration."
dnf -y update || exit_message \
$'Error running pre-update. Stopping now to avoid putting the system in an\n'\
$'unstable state. Please correct the issues shown here and try again.'
}
package_swaps() { package_swaps() {
# Save off any subscription-manger keys, just in case. # Save off any subscription-manger keys, just in case.
if ( shopt -s failglob dotglob; : "$sm_ca_dir"/* ) 2>/dev/null ; then if ( shopt -s failglob dotglob; : "$sm_ca_dir"/* ) 2>/dev/null ; then
@ -846,6 +854,7 @@ fi
if [[ $convert_to_rocky ]]; then if [[ $convert_to_rocky ]]; then
collect_system_info collect_system_info
establish_gpg_trust establish_gpg_trust
pre_update
package_swaps package_swaps
fi fi