mirror of
https://github.com/rocky-linux/rocky-tools.git
synced 2024-11-24 14:11:24 +00:00
Formatting (#97)
* Various formatting and spelling fixes. * Tab to space for more consistent text representation across different editors.
This commit is contained in:
parent
7eb310f907
commit
8d68003ddf
@ -57,7 +57,7 @@ dnf command or the migration. You may safely ignore this message.
|
||||
#### Grub still shows kernel entries from previous installation
|
||||
|
||||
This is normal. The running kernel cannot be safely removed when migrate2rocky
|
||||
is run. The RockyLinux kernel should come up as the default highlighed kernel
|
||||
is run. The RockyLinux kernel should come up as the default highlighted kernel
|
||||
on reboot but the other ones will remain until they are removed or replaced by
|
||||
newer kernels. If you want you can manually remove the old kernels after reboot
|
||||
with dnf or rpm.
|
||||
|
@ -46,7 +46,8 @@ fi
|
||||
|
||||
# Make sure we're root.
|
||||
if (( EUID != 0 )); then
|
||||
printf '%s\n' "You must run this script as root. Either use sudo or 'su -c ${0}'" >&2
|
||||
printf '%s\n' \
|
||||
"You must run this script as root. Either use sudo or 'su -c ${0}'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -202,21 +203,27 @@ exit_clean () {
|
||||
|
||||
pre_check () {
|
||||
if [[ -e /etc/rhsm/ca/katello-server-ca.pem ]]; then
|
||||
exit_message "Migration from Katello-modified systems is not supported by migrate2rocky. See the README file for details."
|
||||
exit_message \
|
||||
'Migration from Katello-modified systems is not supported by migrate2rocky. '\
|
||||
'See the README file for details.'
|
||||
fi
|
||||
if [[ -e /etc/salt/minion.d/susemanager.conf ]]; then
|
||||
exit_message "Migration from Uyuni/SUSE Manager-modified systems is not supported by migrate2rocky. See the README file for details."
|
||||
exit_message \
|
||||
'Migration from Uyuni/SUSE Manager-modified systems is not supported by '\
|
||||
'migrate2rocky. See the README file for details.'
|
||||
fi
|
||||
}
|
||||
|
||||
# All of the binaries used by this script are available in a EL8 minimal install
|
||||
# and are in /bin, so we should not encounter a system where the script doesn't
|
||||
# work unless it's severly broken. This is just a simple check that will cause
|
||||
# work unless it's severely broken. This is just a simple check that will cause
|
||||
# the script to bail if any expected system utilities are missing.
|
||||
bin_check() {
|
||||
# Check the platform.
|
||||
if [[ $(os-release PLATFORM_ID) != "$SUPPORTED_PLATFORM" ]]; then
|
||||
exit_message "This script must be run on an EL8 distribution. Migration from other distributions is not supported."
|
||||
exit_message \
|
||||
'This script must be run on an EL8 distribution. Migration from other '\
|
||||
'distributions is not supported.'
|
||||
fi
|
||||
|
||||
local -a missing bins
|
||||
@ -250,7 +257,9 @@ bin_check() {
|
||||
done;
|
||||
|
||||
if (( ${#missing[@]} )); then
|
||||
exit_message "Commands not found: ${missing[*]}. Possible bad PATH setting or corrupt installation."
|
||||
exit_message \
|
||||
"Commands not found: ${missing[*]}. Possible bad PATH setting or corrupt "\
|
||||
"installation."
|
||||
fi
|
||||
}
|
||||
|
||||
@ -346,7 +355,7 @@ provides_pkg () (
|
||||
)
|
||||
|
||||
# If you pass an empty arg as one of the package specs to rpm it will match
|
||||
# every package on the system. This funtion simply strips out any empty args
|
||||
# every package on the system. This function simply strips out any empty args
|
||||
# and passes the rest to rpm to avoid this side-effect.
|
||||
saferpm () (
|
||||
args=()
|
||||
@ -413,7 +422,9 @@ collect_system_info () {
|
||||
# check if EFI secure boot is enabled
|
||||
if [[ $update_efi ]]; then
|
||||
if mokutil --sb-state 2>&1 | grep -q "SecureBoot enabled"; then
|
||||
exit_message "EFI Secure Boot is enabled but Rocky Linux doesn't provide a signed shim yet. Disable EFI Secure Boot and reboot."
|
||||
exit_message \
|
||||
"EFI Secure Boot is enabled but Rocky Linux doesn't provide a signed shim yet."\
|
||||
" Disable EFI Secure Boot and reboot."
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -460,10 +471,13 @@ collect_system_info () {
|
||||
repo_map[$r]=${repoquery_results[Repository]}
|
||||
done
|
||||
|
||||
printf '%s\n' '' '' "Found the following repositories which map from $PRETTY_NAME to Rocky Linux 8:"
|
||||
column -t -s $'\t' -N "$PRETTY_NAME,Rocky Linux 8" < <(for r in "${!repo_map[@]}"; do
|
||||
printf '%s\n' '' '' \
|
||||
"Found the following repositories which map from $PRETTY_NAME to Rocky Linux 8:"
|
||||
column -t -s $'\t' -N "$PRETTY_NAME,Rocky Linux 8" < <(
|
||||
for r in "${!repo_map[@]}"; do
|
||||
printf '%s\t%s\n' "${repo_map[$r]}" "$r"
|
||||
done)
|
||||
done
|
||||
)
|
||||
|
||||
infomsg $'\n'"Getting system package names for $PRETTY_NAME"
|
||||
|
||||
@ -530,14 +544,20 @@ $'because continuing with the migration could cause further damage to system.'
|
||||
addl_pkg_removes+=("$pkg")
|
||||
done
|
||||
|
||||
printf '%s\n' '' '' "Found the following system packages which map from $PRETTY_NAME to Rocky Linux 8:"
|
||||
column -t -s $'\t' -N "$PRETTY_NAME,Rocky Linux 8" < <(for p in "${!pkg_map[@]}"; do
|
||||
printf '%s\n' '' '' \
|
||||
"Found the following system packages which map from $PRETTY_NAME to Rocky "\
|
||||
"Linux 8:"
|
||||
column -t -s $'\t' -N "$PRETTY_NAME,Rocky Linux 8" < <(
|
||||
for p in "${!pkg_map[@]}"; do
|
||||
printf '%s\t%s\n' "${pkg_map[$p]}" "$p"
|
||||
done)
|
||||
done
|
||||
)
|
||||
|
||||
infomsg $'\n'"Getting list of installed system packages."$'\n'
|
||||
|
||||
readarray -t installed_packages < <(saferpm -qa --queryformat="%{NAME}\n" "${pkg_map[@]}")
|
||||
readarray -t installed_packages < <(
|
||||
saferpm -qa --queryformat="%{NAME}\n" "${pkg_map[@]}"
|
||||
)
|
||||
declare -g -A installed_pkg_check installed_pkg_map
|
||||
for p in "${installed_packages[@]}"; do
|
||||
installed_pkg_check[$p]=1
|
||||
@ -564,7 +584,9 @@ $'because continuing with the migration could cause further damage to system.'
|
||||
fi
|
||||
done
|
||||
|
||||
printf '%s\n' '' "We will replace the following $PRETTY_NAME packages with their Rocky Linux 8 equivalents"
|
||||
printf '%s\n' '' \
|
||||
"We will replace the following $PRETTY_NAME packages with their Rocky Linux 8 "\
|
||||
"equivalents"
|
||||
column -t -s $'\t' -N "Packages to be Removed,Packages to be Installed" < <(
|
||||
for p in "${!installed_pkg_map[@]}"; do
|
||||
printf '%s\t%s\n' "${installed_pkg_map[$p]}" "$p"
|
||||
@ -595,7 +617,7 @@ $'because continuing with the migration could cause further damage to system.'
|
||||
# Release packages that are part of SIG's should be listed below when they
|
||||
# are available.
|
||||
# UPDATE: We may or may not do something with SIG's here, it could just be
|
||||
# left as a separate excersize to swap out the sig repos.
|
||||
# left as a separate exercise to swap out the sig repos.
|
||||
#sigs_to_swap=()
|
||||
|
||||
infomsg '%s' $'\n' \
|
||||
@ -647,7 +669,9 @@ $'because continuing with the migration could cause further damage to system.'
|
||||
"${enabled_modules[@]}" ''
|
||||
|
||||
if (( ${#managed_repos[@]} )); then
|
||||
printf '%s\n' '' "In addition, since this system uses subscription-manger the following managed repos will be disabled:" \
|
||||
printf '%s\n' '' \
|
||||
'In addition, since this system uses subscription-manager the following '\
|
||||
'managed repos will be disabled:' \
|
||||
"${managed_repos[@]}"
|
||||
fi
|
||||
}
|
||||
@ -671,9 +695,13 @@ usage() {
|
||||
generate_rpm_info() {
|
||||
mkdir /root/convert
|
||||
infomsg "Creating a list of RPMs installed: $1"$'\n'
|
||||
rpm -qa --qf "%{NAME}|%{VERSION}|%{RELEASE}|%{INSTALLTIME}|%{VENDOR}|%{BUILDTIME}|%{BUILDHOST}|%{SOURCERPM}|%{LICENSE}|%{PACKAGER}\n" | sort > "${convert_info_dir}/$HOSTNAME-rpm-list-$1.log"
|
||||
rpm -qa --qf \
|
||||
"%{NAME}|%{VERSION}|%{RELEASE}|%{INSTALLTIME}|%{VENDOR}|%{BUILDTIME}|"\
|
||||
"%{BUILDHOST}|%{SOURCERPM}|%{LICENSE}|%{PACKAGER}\n" |
|
||||
sort > "${convert_info_dir}/$HOSTNAME-rpm-list-$1.log"
|
||||
infomsg "Verifying RPMs installed against RPM database: $1"$'\n\n'
|
||||
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.
|
||||
@ -685,7 +713,7 @@ $'unstable state. Please correct the issues shown here and try again.'
|
||||
}
|
||||
|
||||
package_swaps() {
|
||||
# Save off any subscription-manger keys, just in case.
|
||||
# Save off any subscription-manager keys, just in case.
|
||||
if ( shopt -s failglob dotglob; : "$sm_ca_dir"/* ) 2>/dev/null ; then
|
||||
tmp_sm_ca_dir=$tmp_dir/sm-certs
|
||||
mkdir "$tmp_sm_ca_dir" ||
|
||||
@ -732,7 +760,8 @@ package_swaps() {
|
||||
exit
|
||||
EOF
|
||||
|
||||
# rocky-repos and rocky-gpg-keys are now installed, so we don't need the key file anymore
|
||||
# rocky-repos and rocky-gpg-keys are now installed, so we don't need the
|
||||
# key file anymore
|
||||
rm -rf "$gpg_tmp_dir"
|
||||
|
||||
# We need to check to make sure that all of the original system packages
|
||||
@ -817,7 +846,7 @@ EOF
|
||||
|
||||
# Distrosync
|
||||
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[@]}" || {
|
||||
printf '%s\n' 'Repo name missing?'
|
||||
exit 25
|
||||
@ -826,7 +855,8 @@ EOF
|
||||
if (( ${#managed_repos[@]} )); then
|
||||
# Filter the managed repos for ones still in the system.
|
||||
readarray -t managed_repos < <(
|
||||
safednf -q repolist "${managed_repos[@]}" | awk '$1!="repo" {print $1}'
|
||||
safednf -q repolist "${managed_repos[@]}" |
|
||||
awk '$1!="repo" {print $1}'
|
||||
)
|
||||
|
||||
if (( ${#managed_repos[@]} )); then
|
||||
@ -888,7 +918,7 @@ EOF
|
||||
fi
|
||||
|
||||
if rpm --quiet -q subscription-manager; then
|
||||
infomsg $'\nSubscription Manager found on system.\n\n'
|
||||
infomsg $'Subscription Manager found on system.\n\n'
|
||||
cat <<EOF
|
||||
If you're converting from a subscription-managed distribution such as RHEL then
|
||||
you may no longer need subscription-manager or dnf-plugin-subscription-manager.
|
||||
@ -969,13 +999,15 @@ fix_efi () (
|
||||
|
||||
# Download and verify the Rocky Linux package signing key
|
||||
establish_gpg_trust () {
|
||||
# create temp dir and verify it is really created and empty, so we are sure deleting it afterwards won't cause any harm
|
||||
# create temp dir and verify it is really created and empty, so we are sure
|
||||
# deleting it afterwards won't cause any harm
|
||||
declare -g gpg_tmp_dir
|
||||
gpg_tmp_dir=$tmp_dir/gpg
|
||||
if ! mkdir "$gpg_tmp_dir" || [[ ! -d "$gpg_tmp_dir" ]]; then
|
||||
exit_message "Error creating temp dir"
|
||||
fi
|
||||
# failglob makes pathname expansion fail if empty, dotglob adds files starting with . to pathname expansion
|
||||
# failglob makes pathname expansion fail if empty, dotglob adds files
|
||||
# starting with . to pathname expansion
|
||||
if ( shopt -s failglob dotglob; : "$gpg_tmp_dir"/* ) 2>/dev/null ; then
|
||||
exit_message "Temp dir not empty"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user