From f28f6daa0e4caa29e5b1052dca6daddc005116d4 Mon Sep 17 00:00:00 2001 From: Peter Ajamian Date: Wed, 24 Nov 2021 00:21:41 +1300 Subject: [PATCH] Certain Stream packages have to be replaced by their Rocky Linux equivalents. --- migrate2rocky/migrate2rocky.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/migrate2rocky/migrate2rocky.sh b/migrate2rocky/migrate2rocky.sh index 8bfc1bc..e1aa221 100644 --- a/migrate2rocky/migrate2rocky.sh +++ b/migrate2rocky/migrate2rocky.sh @@ -133,9 +133,18 @@ stream_repos_pkgs=( [rocky-repos]=centos-stream-repos [epel-release]=epel-next-release ) + # Prefix to add to CentOS stream repo names when renaming them. stream_prefix=stream- +# Always replace these stream packages with their Rocky Linux equivalents. +stream_always_replace=( + fwupdate\* + grub2-\* + kernel + kernel-\* +) + unset CDPATH exit_message() { @@ -743,13 +752,13 @@ package_swaps() { grep '^/etc/yum\.repos\.d/.\+\.repo$' ) - if (( ${#installed_sys_stream_repos_pkgs[@]} )); then + if (( ${#installed_sys_stream_repos_pkgs[@]} )); then # Remove the package from the rpm db. saferpm -e --justdb --nodeps -a \ "${installed_sys_stream_repos_pkgs[@]}" || exit_message \ "Could not remove packages from the rpm db: ${installed_sys_stream_repos_pkgs[*]}" - fi + fi # Rename the stream repos with a prefix and fix the baseurl. sed -i \ @@ -757,7 +766,7 @@ package_swaps() { -e 's|^mirrorlist=|#mirrorlist=|g' \ -e 's|^#baseurl=http://mirror.centos.org/$contentdir/$stream/|baseurl=|http://mirror.centos.org/centos/8-stream/' \ -e 's|^baseurl=http://vault.centos.org/$contentdir/$stream/|baseurl=|https://vault.centos.org/centos/8-stream/' \ - "${repos_files[@]}" + "${repos_files[@]}" fi # Use dnf shell to swap the system packages out. @@ -905,6 +914,12 @@ EOF errmsg \ $'Failed to disable CentOS Stream repos, please check and disable manually.\n' + if (( ${#stream_always_replace[@]} )) && + [[ $(saferpm -qa "${stream_always_replace[@]}") ]]; then + safednf -y distro-sync "${stream_always_replace[@]}" || + exit_message "Error during distro-sync." + fi + infomsg $'\nCentOS Stream Migration Notes:\n\n' cat <