mirror of
https://github.com/rocky-linux/rocky-tools.git
synced 2024-11-21 20:51:26 +00:00
Merge pull request #128 from pajamian/stream_logic
Fix issues with migrating from CentOS Stream 8
This commit is contained in:
commit
e6ec182c27
@ -133,9 +133,19 @@ stream_repos_pkgs=(
|
|||||||
[rocky-repos]=centos-stream-repos
|
[rocky-repos]=centos-stream-repos
|
||||||
[epel-release]=epel-next-release
|
[epel-release]=epel-next-release
|
||||||
)
|
)
|
||||||
|
|
||||||
# Prefix to add to CentOS stream repo names when renaming them.
|
# Prefix to add to CentOS stream repo names when renaming them.
|
||||||
stream_prefix=stream-
|
stream_prefix=stream-
|
||||||
|
|
||||||
|
# Always replace these stream packages with their Rocky Linux equivalents.
|
||||||
|
stream_always_replace=(
|
||||||
|
fwupdate\*
|
||||||
|
grub2-\*
|
||||||
|
shim-\*
|
||||||
|
kernel
|
||||||
|
kernel-\*
|
||||||
|
)
|
||||||
|
|
||||||
unset CDPATH
|
unset CDPATH
|
||||||
|
|
||||||
exit_message() {
|
exit_message() {
|
||||||
@ -733,7 +743,8 @@ package_swaps() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# CentOS Stream specific processing
|
# CentOS Stream specific processing
|
||||||
if (( ${#installed_stream_repos_pkgs[@]} )); then
|
if (( ${#installed_stream_repos_pkgs[@]} ||
|
||||||
|
${#installed_sys_stream_repos_pkgs[@]} )); then
|
||||||
# Get a list of the repo files.
|
# Get a list of the repo files.
|
||||||
local -a repos_files
|
local -a repos_files
|
||||||
readarray -t repos_files < <(
|
readarray -t repos_files < <(
|
||||||
@ -742,13 +753,21 @@ package_swaps() {
|
|||||||
grep '^/etc/yum\.repos\.d/.\+\.repo$'
|
grep '^/etc/yum\.repos\.d/.\+\.repo$'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Remove the package from the rpm db.
|
if (( ${#installed_sys_stream_repos_pkgs[@]} )); then
|
||||||
saferpm -e --justdb --nodeps -a "${installed_sys_stream_repos_pkgs[@]}" ||
|
# Remove the package from the rpm db.
|
||||||
|
saferpm -e --justdb --nodeps -a \
|
||||||
|
"${installed_sys_stream_repos_pkgs[@]}" ||
|
||||||
exit_message \
|
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[*]}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Rename the stream repos with a prefix.
|
# Rename the stream repos with a prefix and fix the baseurl.
|
||||||
sed -i 's/^\[/['"$stream_prefix"'/' "${repos_files[@]}"
|
sed -i \
|
||||||
|
-e 's/^\[/['"$stream_prefix"'/' \
|
||||||
|
-e 's|^mirrorlist=|#mirrorlist=|' \
|
||||||
|
-e 's|^#baseurl=http://mirror.centos.org/$contentdir/$stream/|baseurl=http://mirror.centos.org/centos/8-stream/|' \
|
||||||
|
-e 's|^baseurl=http://vault.centos.org/$contentdir/$stream/|baseurl=https://vault.centos.org/centos/8-stream/|' \
|
||||||
|
"${repos_files[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use dnf shell to swap the system packages out.
|
# Use dnf shell to swap the system packages out.
|
||||||
@ -896,6 +915,12 @@ EOF
|
|||||||
errmsg \
|
errmsg \
|
||||||
$'Failed to disable CentOS Stream repos, please check and disable manually.\n'
|
$'Failed to disable CentOS Stream repos, please check and disable manually.\n'
|
||||||
|
|
||||||
|
if (( ${#stream_always_replace[@]} )) &&
|
||||||
|
[[ $(saferpm -qa "${stream_always_replace[@]}") ]]; then
|
||||||
|
safednf -y distro-sync "${stream_always_replace[@]}" ||
|
||||||
|
exit_message "Error during distro-sync."
|
||||||
|
fi
|
||||||
|
|
||||||
infomsg $'\nCentOS Stream Migration Notes:\n\n'
|
infomsg $'\nCentOS Stream Migration Notes:\n\n'
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Because CentOS Stream leads RockyLinux by the next point release many packages
|
Because CentOS Stream leads RockyLinux by the next point release many packages
|
||||||
|
Loading…
Reference in New Issue
Block a user