From 49fa13494efb0dd43792e6fa76f6d3e725fc2390 Mon Sep 17 00:00:00 2001 From: Peter Ajamian Date: Wed, 12 May 2021 13:44:41 +1200 Subject: [PATCH] Account for no modules. It is possible that we may get a system with no modules enabled. Test and account for this by skipping the enable modules step if necessary. --- migrate2rocky.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/migrate2rocky.sh b/migrate2rocky.sh index b482d99..60a8c8d 100644 --- a/migrate2rocky.sh +++ b/migrate2rocky.sh @@ -298,15 +298,17 @@ EOF printf '%s\n' 'Repo name missing?' exit 25 } - printf '%s\n' "${blue}Enabling modules$nocolor" '' - # We may very well need to do a reset/install here, but it takes a decent - # amount of time, so we're better off just doing an enable unless we end up - # with an explicit test case where reset/install is needed. + if (( ${#enabled_modules[@]} )); then + printf '%s\n' "${blue}Enabling modules$nocolor" '' + # We may very well need to do a reset/install here, but it takes a + # decent amount of time, so we're better off just doing an enable unless + # we end up with an explicit test case where reset/install is needed. # dnf -y module reset "${enabled_modules[@]}" # dnf -y module install "${enabled_modules[@]}" - dnf -y module enable "${enabled_modules[@]}" || - exit_message "Can't enable modules ${enabled_modules[@]}" + dnf -y module enable "${enabled_modules[@]}" || + exit_message "Can't enable modules ${enabled_modules[@]}" + fi printf '%s\n' '' "${blue}Syncing packages$nocolor" '' dnf -y distro-sync || exit_message "Error during distro-sync." }