Shellcheck fixes.

Various fixes reported by shellcheck.
This commit is contained in:
Peter Ajamian 2021-11-18 14:50:00 +13:00
parent 22455ba221
commit 28be74a123

View File

@ -204,11 +204,13 @@ exit_clean () {
pre_check () {
if [[ -e /etc/rhsm/ca/katello-server-ca.pem ]]; then
# shellcheck disable=SC2026
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
# shellcheck disable=SC2026
exit_message \
'Migration from Uyuni/SUSE Manager-modified systems is not supported by '\
'migrate2rocky. See the README file for details.'
@ -222,6 +224,7 @@ pre_check () {
bin_check() {
# Check the platform.
if [[ $(os-release PLATFORM_ID) != "$SUPPORTED_PLATFORM" ]]; then
# shellcheck disable=SC2026
exit_message \
'This script must be run on an EL8 distribution. Migration from other '\
'distributions is not supported.'
@ -258,6 +261,7 @@ bin_check() {
done;
if (( ${#missing[@]} )); then
# shellcheck disable=SC2140
exit_message \
"Commands not found: ${missing[*]}. Possible bad PATH setting or corrupt "\
"installation."
@ -536,6 +540,7 @@ $'because continuing with the migration could cause further damage to system.'
addl_pkg_removes+=("$pkg")
done
# shellcheck disable=SC2140
printf '%s\n' '' '' \
"Found the following system packages which map from $PRETTY_NAME to Rocky "\
"Linux 8:"
@ -576,6 +581,7 @@ $'because continuing with the migration could cause further damage to system.'
fi
done
# shellcheck disable=SC2140
printf '%s\n' '' \
"We will replace the following $PRETTY_NAME packages with their Rocky Linux 8 "\
"equivalents"
@ -586,6 +592,7 @@ $'because continuing with the migration could cause further damage to system.'
)
if (( ${#installed_sys_stream_repos_pkgs[@]} )); then
# shellcheck disable=SC2026
printf '%s\n' '' \
'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 '\
@ -594,6 +601,7 @@ $'because continuing with the migration could cause further damage to system.'
fi
if (( ${#installed_stream_repos_pkgs[@]} )); then
# shellcheck disable=SC2026
printf '%s\n' '' \
'Also to aid the transition from CentOS Stream the repos included in the '\
'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[@]}" ''
if (( ${#managed_repos[@]} )); then
# shellcheck disable=SC2026
printf '%s\n' '' \
'In addition, since this system uses subscription-manager the following '\
'managed repos will be disabled:' \
@ -687,6 +696,7 @@ usage() {
generate_rpm_info() {
mkdir /root/convert
infomsg "Creating a list of RPMs installed: $1"$'\n'
# shellcheck disable=SC2140
rpm -qa --qf \
"%{NAME}|%{VERSION}|%{RELEASE}|%{INSTALLTIME}|%{VENDOR}|%{BUILDTIME}|"\
"%{BUILDHOST}|%{SOURCERPM}|%{LICENSE}|%{PACKAGER}\n" |
@ -735,7 +745,7 @@ package_swaps() {
# 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[@]}"
"Could not remove packages from the rpm db: ${installed_sys_stream_repos_pkgs[*]}"
# Rename the stream repos with a prefix.
sed -i 's/^\[/['"$stream_prefix"'/' "${repos_files[@]}"