Merge branch 'main' into stream_logic

This commit is contained in:
Peter Ajamian 2021-11-23 22:51:34 +13:00 committed by GitHub
commit 6fb8cb8dd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,11 +204,13 @@ exit_clean () {
pre_check () { pre_check () {
if [[ -e /etc/rhsm/ca/katello-server-ca.pem ]]; then if [[ -e /etc/rhsm/ca/katello-server-ca.pem ]]; then
# shellcheck disable=SC2026
exit_message \ exit_message \
'Migration from Katello-modified systems is not supported by migrate2rocky. '\ 'Migration from Katello-modified systems is not supported by migrate2rocky. '\
'See the README file for details.' 'See the README file for details.'
fi fi
if [[ -e /etc/salt/minion.d/susemanager.conf ]]; then if [[ -e /etc/salt/minion.d/susemanager.conf ]]; then
# shellcheck disable=SC2026
exit_message \ exit_message \
'Migration from Uyuni/SUSE Manager-modified systems is not supported by '\ 'Migration from Uyuni/SUSE Manager-modified systems is not supported by '\
'migrate2rocky. See the README file for details.' 'migrate2rocky. See the README file for details.'
@ -222,6 +224,7 @@ pre_check () {
bin_check() { bin_check() {
# Check the platform. # Check the platform.
if [[ $(os-release PLATFORM_ID) != "$SUPPORTED_PLATFORM" ]]; then if [[ $(os-release PLATFORM_ID) != "$SUPPORTED_PLATFORM" ]]; then
# shellcheck disable=SC2026
exit_message \ exit_message \
'This script must be run on an EL8 distribution. Migration from other '\ 'This script must be run on an EL8 distribution. Migration from other '\
'distributions is not supported.' 'distributions is not supported.'
@ -230,10 +233,10 @@ bin_check() {
local -a missing bins local -a missing bins
bins=( bins=(
rpm dnf awk column tee tput mkdir cat arch sort uniq rmdir rpm dnf awk column tee tput mkdir cat arch sort uniq rmdir
rm head curl sha512sum mktemp systemd-detect-virt sed rm head curl sha512sum mktemp systemd-detect-virt sed grep
) )
if [[ $update_efi ]]; then if [[ $update_efi ]]; then
bins+=(findmnt grub2-mkconfig efibootmgr grep mokutil lsblk) bins+=(findmnt grub2-mkconfig efibootmgr mokutil lsblk)
fi fi
for bin in "${bins[@]}"; do for bin in "${bins[@]}"; do
if ! type "$bin" >/dev/null 2>&1; then if ! type "$bin" >/dev/null 2>&1; then
@ -258,6 +261,7 @@ bin_check() {
done; done;
if (( ${#missing[@]} )); then if (( ${#missing[@]} )); then
# shellcheck disable=SC2140
exit_message \ exit_message \
"Commands not found: ${missing[*]}. Possible bad PATH setting or corrupt "\ "Commands not found: ${missing[*]}. Possible bad PATH setting or corrupt "\
"installation." "installation."
@ -536,6 +540,7 @@ $'because continuing with the migration could cause further damage to system.'
addl_pkg_removes+=("$pkg") addl_pkg_removes+=("$pkg")
done done
# shellcheck disable=SC2140
printf '%s\n' '' '' \ printf '%s\n' '' '' \
"Found the following system packages which map from $PRETTY_NAME to Rocky "\ "Found the following system packages which map from $PRETTY_NAME to Rocky "\
"Linux 8:" "Linux 8:"
@ -576,6 +581,7 @@ $'because continuing with the migration could cause further damage to system.'
fi fi
done done
# shellcheck disable=SC2140
printf '%s\n' '' \ printf '%s\n' '' \
"We will replace the following $PRETTY_NAME packages with their Rocky Linux 8 "\ "We will replace the following $PRETTY_NAME packages with their Rocky Linux 8 "\
"equivalents" "equivalents"
@ -586,6 +592,7 @@ $'because continuing with the migration could cause further damage to system.'
) )
if (( ${#installed_sys_stream_repos_pkgs[@]} )); then if (( ${#installed_sys_stream_repos_pkgs[@]} )); then
# shellcheck disable=SC2026
printf '%s\n' '' \ printf '%s\n' '' \
'Also to aid the transition from CentOS Stream the following packages will be '\ 'Also to aid the transition from CentOS Stream the following packages will be '\
'removed from the rpm database but the included repos will be renamed and '\ 'removed from the rpm database but the included repos will be renamed and '\
@ -594,6 +601,7 @@ $'because continuing with the migration could cause further damage to system.'
fi fi
if (( ${#installed_stream_repos_pkgs[@]} )); then if (( ${#installed_stream_repos_pkgs[@]} )); then
# shellcheck disable=SC2026
printf '%s\n' '' \ printf '%s\n' '' \
'Also to aid the transition from CentOS Stream the repos included in the '\ 'Also to aid the transition from CentOS Stream the repos included in the '\
'following packages will be renamed and retained but disabled:' \ 'following packages will be renamed and retained but disabled:' \
@ -661,6 +669,7 @@ $'because continuing with the migration could cause further damage to system.'
"${enabled_modules[@]}" '' "${enabled_modules[@]}" ''
if (( ${#managed_repos[@]} )); then if (( ${#managed_repos[@]} )); then
# shellcheck disable=SC2026
printf '%s\n' '' \ printf '%s\n' '' \
'In addition, since this system uses subscription-manager the following '\ 'In addition, since this system uses subscription-manager the following '\
'managed repos will be disabled:' \ 'managed repos will be disabled:' \
@ -687,6 +696,7 @@ usage() {
generate_rpm_info() { generate_rpm_info() {
mkdir /root/convert mkdir /root/convert
infomsg "Creating a list of RPMs installed: $1"$'\n' infomsg "Creating a list of RPMs installed: $1"$'\n'
# shellcheck disable=SC2140
rpm -qa --qf \ rpm -qa --qf \
"%{NAME}|%{VERSION}|%{RELEASE}|%{INSTALLTIME}|%{VENDOR}|%{BUILDTIME}|"\ "%{NAME}|%{VERSION}|%{RELEASE}|%{INSTALLTIME}|%{VENDOR}|%{BUILDTIME}|"\
"%{BUILDHOST}|%{SOURCERPM}|%{LICENSE}|%{PACKAGER}\n" | "%{BUILDHOST}|%{SOURCERPM}|%{LICENSE}|%{PACKAGER}\n" |
@ -738,7 +748,7 @@ package_swaps() {
saferpm -e --justdb --nodeps -a \ saferpm -e --justdb --nodeps -a \
"${installed_sys_stream_repos_pkgs[@]}" || "${installed_sys_stream_repos_pkgs[@]}" ||
exit_message \ exit_message \
"Could not remove packages from the rpm db: ${installed_sys_stream_repos_pkgs[@]}" "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. # Rename the stream repos with a prefix and fix the baseurl.
@ -847,7 +857,7 @@ EOF
# Distrosync # Distrosync
infomsg $'Ensuring repos are enabled before the package swap\n' infomsg $'Ensuring repos are enabled before the package swap\n'
safednf -y --enableplugin=config-manager config-manager \ safednf -y --enableplugin=config_manager config-manager \
--set-enabled "${!repo_map[@]}" || { --set-enabled "${!repo_map[@]}" || {
printf '%s\n' 'Repo name missing?' printf '%s\n' 'Repo name missing?'
exit 25 exit 25
@ -862,7 +872,7 @@ EOF
if (( ${#managed_repos[@]} )); then if (( ${#managed_repos[@]} )); then
infomsg $'\nDisabling subscription managed repos\n' infomsg $'\nDisabling subscription managed repos\n'
safednf -y --enableplugin=config-manager config-manager \ safednf -y --enableplugin=config_manager config-manager \
--disable "${managed_repos[@]}" --disable "${managed_repos[@]}"
fi fi
fi fi