From d3d4896e39b745259eddaf3ca3d5a102d761d366 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Sat, 1 Jan 2022 00:51:07 -0500 Subject: [PATCH] migrate2rocky minor improvements (#140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- migrate2rocky/migrate2rocky.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migrate2rocky/migrate2rocky.sh b/migrate2rocky/migrate2rocky.sh index 39f95bd..1e05fef 100644 --- a/migrate2rocky/migrate2rocky.sh +++ b/migrate2rocky/migrate2rocky.sh @@ -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