Attempt Fixes

* Attempt to consolidate URL's
* Attempt to find correct release versions for consistency to minor
  release that is supported - This also allows to remove minor version
  and just use major version.
* Pull RPM's instead of trying to install directly from the URL
This commit is contained in:
nazunalika 2021-05-01 18:06:53 -07:00
parent 2aeea50186
commit 58de053cbc
Signed by: label
GPG key ID: 6735C0E1BD65D048

View file

@ -11,7 +11,7 @@ fi
SUPPORTED_RELEASE="8.3" SUPPORTED_RELEASE="8.3"
SUPPORTED_MAJOR="8" SUPPORTED_MAJOR="8"
current_url=https://mirror.rockylinux.org/rocky current_url="https://dl.rockylinux.org/pub/rocky/${SUPPORTED_RELEASE}/BaseOS/x86_64/os/Packages"
# These are packages that can be swapped safely over and will have more added over time. # These are packages that can be swapped safely over and will have more added over time.
packages_to_swap=( packages_to_swap=(
centos-backgrounds \ centos-backgrounds \
@ -21,6 +21,9 @@ packages_to_swap=(
centos-gpg-keys \ centos-gpg-keys \
centos-linux-release) centos-linux-release)
packages_that_exist=($(rpm -q --queryformat="%{NAME}\n" "${packages_to_swap[@]}" | grep -v "not installed"))
release_to_install=($(curl -s ${REPO_URL} | awk -F '"' '/rocky-repos|rocky-gpg-keys|rocky-release/ {print $2}'))
# Release packages that are part of SIG's should be listed below when they are available. # Release packages that are part of SIG's should be listed below when they are available.
#sigs_to_swap=() #sigs_to_swap=()
@ -73,10 +76,20 @@ generate_rpm_info() {
} }
package_swaps() { package_swaps() {
rpm -e --nodeps "${packages_to_swap[@]}" mkdir /root/release
rpm -ihv ${current_url}/${SUPPORTED_RELEASE}/BaseOS/x86_64/os/Packages/rocky-release-${SUPPORTED_RELEASE}-11.el8.x86_64.rpm \ pushd /root/release
${current_url}/${SUPPORTED_RELEASE}/BaseOS/x86_64/os/Packages/rocky-repos-${SUPPORTED_MAJOR}-11.el8.x86_64.rpm \
${current_url}/${SUPPORTED_RELEASE}/BaseOS/x86_64/os/Packages/rocky-gpg-keys-${SUPPORTED_MAJOR}-11.el8.x86_64.rpm for x in "${release_to_install[@]}"; do
wget -q "${current_url}/${x}" || { echo "failed to download ${x}" ; exit 20; }
done
# Remove packages we need to swap
rpm -e --nodeps "${packages_that_exist[@]}"
# Install our release
rpm -ihv "${release_to_install[@]}"
# Distrosync if the above succeeded
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Removing dnf cache" echo "Removing dnf cache"
rm -rf /var/cache/{yum,dnf} rm -rf /var/cache/{yum,dnf}
@ -86,6 +99,7 @@ package_swaps() {
else else
exit_message "We failed to install the release package." exit_message "We failed to install the release package."
fi fi
popd
} }
sig_swaps() { sig_swaps() {
@ -104,6 +118,9 @@ module_check() {
esac esac
done done
if [ ${#unknown_modules[@]} -gt 0 ]; then if [ ${#unknown_modules[@]} -gt 0 ]; then
for x in "${unknown_modules[@]}"; do
echo "${x}"
done
echo "There are some modules that are unsure of how to handle. This normally shouldn't happen. Do you want to resolve this yourself (Yes) or continue (No)?" echo "There are some modules that are unsure of how to handle. This normally shouldn't happen. Do you want to resolve this yourself (Yes) or continue (No)?"
select yn in "Yes" "No"; do select yn in "Yes" "No"; do
case $yn in case $yn in
@ -159,8 +176,8 @@ while getopts "hrVR" option; do
esac esac
done done
echo "Ensuring rpm, yum, and curl are here." echo "Ensuring rpm, yum, and wget are here."
for pkg in rpm yum curl; do for pkg in rpm yum wget curl; do
bin_check "${pkg}" bin_check "${pkg}"
done done