migrate2rocky minor improvements (#140)

* 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.
This commit is contained in:
Todd Zullinger 2022-01-01 00:51:07 -05:00 committed by GitHub
parent 68c77adbb3
commit d3d4896e39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -785,7 +785,7 @@ usage() {
} >&2
generate_rpm_info() {
mkdir /root/convert
mkdir -p "$convert_info_dir"
infomsg "Creating a list of RPMs installed: $1"$'\n'
# shellcheck disable=SC2140
rpm -qa --qf \
@ -1185,7 +1185,7 @@ fi
if [[ $verify_all_rpms && $convert_to_rocky ]]; then
generate_rpm_info finish
infomsg $'You may review the following files:\n'
find /root/convert -type f -name "$HOSTNAME-rpms-*.log"
printf '%s\n' "$convert_info_dir/$HOSTNAME-rpm-list-"*.log
fi
if [[ $update_efi && $convert_to_rocky ]]; then