* Add devel repo to list of repositories to migrate.
* Use baseurl from our CentOS vault mirror.
CentOS killed off all the CentOS 8 repos and moved them to vault. As a result
migrate2rocky was no longer working to migrate CentOS 8 installs. To fix this
we've mirrored the CentOS 8 vault and point migrate2rocky to that instead.
* Quote to prevent splitting
* Remove dir_mount_map variable
* Define efi_disk and efi_partition as array
* Expanding an array without an index only gives the first element
* Ignore shellchecking /etc/os-release
* Expressions do not need to expand
* migrate2rocky: use $convert_info_dir consistently
We set convert_info_dir=/root/convert. Use it consistently.
* migrate2rocky: avoid mkdir error with -rV options
Both -r and -V call `generate_rpm_info()` which run `mkdir` to create
the convert directory. The second call results in a warning:
mkdir: cannot create directory ‘/root/convert’: File exists
Use `mkdir -p` to avoid the spurious warning when the convert directory
exists.
* migrate2rocky: fix listing of rpm info files
When the conversion completes, the script prints:
You may review the following files:
However, there are no files displayed because the find pattern does not
match what `generate_rpm_info()` writes. It looks for '*-rpms-*' while
the files are named '*-rpm-list-*' instead.
Fix the file pattern used. While here, replace the use of `find` with a
simpler `printf` to achieve the same result.
* fix migrate2rocky script for aarch64 systems by using correct suffix for grub2-efi* and shim* packages
* wrap value passed to -l option of efibootmgr command in quotes
We shouldn't be setting EFI boot to grubx64.efi, but rather shimx64.efi instead.
This commit also makes sure that both grub2-x64 and shim-x64 are properly
installed in an EFI boot system.
The mirrorlist URLs rely on variable replacements from CentOS Stream that are
not valid once we have switched to Rocky Linux. To fix this we change to the
baseurl instead and fix it up to not rely on those variables that have changed.
There are cases where dnf might wait for confirmation, sometimes for a missing
key, etc, that one would not expect. By always passing "-y" we ensure this
isn't an issue.
en_US is not guaranteed to be installed on all systems, but C is, so we use the
C locale to guarantee that all the dnf and rpm command output parses properly.
* CentOS Stream changes
* Retain CentOS Stream repositories and packages to avoid version downgrade
issues.
* Only remove centos-stream-repos from the rpm db, do not actually uninstall the
files.
* Rename system repositories from CentOS Stream with a "stream-" prefix to avoid
clashing with Rockylinux system repository names.
* Disable CentOS Stream repositories after the distro-sync.
Note that these changes will leave CentOS Stream packages on the system, likely
until the next RockyLinux point release. This is intentional to avoid issues
with downgrading package versions.
* Apply stream logic to epel-next-release.
epel-next-release is installed for CentOS stream machines with
EPEL. Apply similar logic for epel-next as for CentOS stream.
Containers generally bind-mount /sys and /proc, so if dnf or rpm attempts to
write to write to one of them it can cause issues with the host system, or just
fail alltogether. We set an rpm macro to prevent this from happening.
Containers (at least many fo them) will bind-mount /sys which works for most
cases but it means that /sys will indicate EFI boot when it is, in fact, the
host system that has EFI boot. To fix this we use systemd-detect-virt to see if
we're running in a container and if so we don't attempt to update EFI boot.
curl won't follow redirects without -L. Since redirects are used by some who
have a private repository this breaks curl in those instances. Adding -L fixes
the problem.
We use features that were introduced in bash 4.2, specifically negative array
indexing. Since EL8 comes stock with bash 4.4 this is not an issue but just in
case someone has done somethign stupid we update our version check to make sure
that at least 4.2 is being run.
OracleLinux renames a nubmer of module streams from rhel8 to ol8 and from rhel
to ol. This commit maps the names back to rhel8 and rhel so that migrate2rocky
doesn't blow up on them.
If there's going to be errors due to corrupted repos, etc we want to find out
right away so we can bail before we put the system in an unstable state. To
this end we dump the dnf cache right away to make sure that dnf is forced to hit
the repos insteada of relying on cached data.
In order to properly parse output from certain commands we must ensure that
output is in the correct locale and character set. Previously we had just set
LANG but that doesn't force the issue and some systems may still have issues.
While this change will override a person's foreign language preferences this is
preferable to it causing a failed migration.
Check to make sure that dnf-plugins-core is present, and force-enable the
config-manager plugin for those dnf commands that need it in case it has been
disabled.
* 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.
* efibootmgr needs separate disk and partition
efibootmgr needs a separate device (/dev/xxx) and partition number.
Co-authored-by: McNutnut <mcnutnut90@gmail.com>