@@ -11,6 +11,7 @@ unset CDPATH
11
11
12
12
yum_url=https://yum.oracle.com
13
13
14
+ github_url=https://github.com/oracle/centos2ol/
14
15
bad_packages=(centos-backgrounds centos-logos centos-release centos-release-cr desktop-backgrounds-basic \
15
16
centos-release-advanced-virtualization centos-release-ansible26 centos-release-ansible-27 \
16
17
centos-release-ansible-28 centos-release-ansible-29 centos-release-azure \
@@ -158,6 +159,45 @@ case "$os_version" in
158
159
;;
159
160
esac
160
161
162
+ if [[ " $os_version " =~ 8.* ]]; then
163
+ echo " Identifying dnf modules that are enabled"
164
+ # There are a few dnf modules that are named after the distribution
165
+ # for each steam named 'rhel' or 'rhel8' we need to make alterations to 'ol' or 'ol8'
166
+ # Before we start the switch, identify if there are any present we don't know how to handle
167
+ mapfile -t modules_enabled < <( dnf module list --enabled | grep rhel | awk ' {print $1}' )
168
+ if [[ " ${modules_enabled[*]} " ]]; then
169
+ # Create an array of modules we don't know how to manage
170
+ unknown_modules=()
171
+ for module in " ${modules_enabled[@]} " ; do
172
+ case ${module} in
173
+ container-tools|go-toolset|jmc|llvm-toolset|rust-toolset|virt)
174
+ ;;
175
+ * )
176
+ # Add this module name to our array of modules we don't know how to manage
177
+ unknown_modules+=(" ${module} " )
178
+ ;;
179
+ esac
180
+ done
181
+ # If we have any modules we don't know how to manage, ask the user how to proceed
182
+ if [ ${# unknown_modules[@]} -gt 0 ]; then
183
+ echo " This tool is unable to automatically switch module(s) '${unknown_modules[*]} ' from a CentOS 'rhel' stream to
184
+ an Oracle Linux equivalent. Do you want to continue and resolve it manually?
185
+ You may want select No to stop and raise an issue on ${github_url} for advice."
186
+ select yn in " Yes" " No" ; do
187
+ case $yn in
188
+ Yes )
189
+ break
190
+ ;;
191
+ No )
192
+ echo " Unsure how to switch module(s) '${unknown_modules[*]} '. Exiting as requested"
193
+ exit 1
194
+ ;;
195
+ esac
196
+ done
197
+ fi
198
+ fi
199
+ fi
200
+
161
201
echo " Finding your repository directory..."
162
202
case " $os_version " in
163
203
8* )
@@ -416,11 +456,24 @@ case "$os_version" in
416
456
fi
417
457
;;
418
458
8* )
419
- # Workaround for qemu-guest-agent packages installed from virt modules
420
- if rpm -q qemu-guest-agent; then
421
- dnf module reset -y virt
422
- dnf module enable -y virt
423
- dnf install -y --allowerasing qemu-guest-agent
459
+ # There are a few dnf modules that are named after the distribution
460
+ # for each steam named 'rhel' or 'rhel8' perform a module reset and install
461
+ if [[ " ${modules_enabled[*]} " ]]; then
462
+ for module in " ${modules_enabled[@]} " ; do
463
+ dnf module reset -y " ${module} "
464
+ case ${module} in
465
+ container-tools|go-toolset|jmc|llvm-toolset|rust-toolset)
466
+ dnf module install -y " ${module} " :ol8
467
+ ;;
468
+ virt)
469
+ dnf module install -y " ${module} " :ol
470
+ ;;
471
+ * )
472
+ echo " Unsure how to transform module ${module} "
473
+ ;;
474
+ esac
475
+ done
476
+ dnf --assumeyes --disablerepo " *" --enablerepo " ol8_appstream" update
424
477
fi
425
478
426
479
# Two logo RPMs aren't currently covered by 'replaces' metadata, replace by hand.
0 commit comments