From 4d2c2f21e44ad353a95f552fc6ced35199af1199 Mon Sep 17 00:00:00 2001 From: Seaton Jiang Date: Tue, 22 Feb 2022 23:31:17 +0800 Subject: [PATCH] fix: shellcheck error --- migrate2rocky/README.md | 3 +-- migrate2rocky/migrate2rocky.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/migrate2rocky/README.md b/migrate2rocky/README.md index d2456da..e929dcd 100644 --- a/migrate2rocky/README.md +++ b/migrate2rocky/README.md @@ -16,12 +16,11 @@ Running this script will convert an existing CentOS 8 system to Rocky Linux 8. #### Use Mirror URLs of Rocky Linux ```bash -export ROCKY_ENV_MIRROR_URL="https://mirrors.example.org/rocky" +export ROCKY_REPO_MIRROR_URL="https://mirrors.example.org/rocky" ./migrate2rocky.sh -r ``` - ### Disk Space Requirements Please note the following disk space requirements. These requirements may vary diff --git a/migrate2rocky/migrate2rocky.sh b/migrate2rocky/migrate2rocky.sh index 9a68608..3a4c3e0 100644 --- a/migrate2rocky/migrate2rocky.sh +++ b/migrate2rocky/migrate2rocky.sh @@ -137,10 +137,10 @@ SUPPORTED_PLATFORM="platform:el$SUPPORTED_MAJOR" ARCH=$(arch) # Use Mirror URLs of Rocky Linux from environment if set. -ROCKY_DEFAULT_URL="https://dl.rockylinux.org/pub/rocky" -ROCKY_MIRROR_URL="${ROCKY_ENV_MIRROR_URL:-"${ROCKY_DEFAULT_URL}"}" +ROCKY_REPO_DEFAULT_URL="https://dl.rockylinux.org/pub/rocky" +ROCKY_REPO_URL="${ROCKY_REPO_MIRROR_URL:-"${ROCKY_REPO_DEFAULT_URL}"}" -gpg_key_url="${ROCKY_MIRROR_URL}/RPM-GPG-KEY-rockyofficial" +gpg_key_url="${ROCKY_REPO_URL}/RPM-GPG-KEY-rockyofficial" gpg_key_sha512="88fe66cf0a68648c2371120d56eb509835266d9efdf7c8b9ac8fc101bdf1f0e0197030d3ea65f4b5be89dc9d1ef08581adb068815c88d7b1dc40aa1c32990f6a" sm_ca_dir=/etc/rhsm/ca @@ -149,8 +149,8 @@ unset tmp_sm_ca_dir # all repos must be signed with the same key given in $gpg_key_url declare -A repo_urls repo_urls=( - [rockybaseos]="${ROCKY_MIRROR_URL}/${SUPPORTED_MAJOR}/BaseOS/$ARCH/os/" - [rockyappstream]="${ROCKY_MIRROR_URL}/${SUPPORTED_MAJOR}/AppStream/$ARCH/os/" + [rockybaseos]="${ROCKY_REPO_URL}/${SUPPORTED_MAJOR}/BaseOS/$ARCH/os/" + [rockyappstream]="${ROCKY_REPO_URL}/${SUPPORTED_MAJOR}/AppStream/$ARCH/os/" ) # These are additional packages that should always be installed. @@ -1066,11 +1066,11 @@ EOF fi # Replace mirror - if [[ $ROCKY_ENV_MIRROR_URL ]]; then + if [[ $ROCKY_REPO_MIRROR_URL ]]; then local -a repo_files readarray -t repo_files < <(rpm -ql rocky-repos | grep '\.repo$') sed -e 's|^mirrorlist=|#mirrorlist=|g' \ - -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl='"$ROCKY_MIRROR_URL"'|g' \ + -e "s|^#baseurl=http://dl.rockylinux.org/\$contentdir|baseurl=${ROCKY_REPO_URL}|g" \ -i.migrate2rocky \ "${repo_files[@]}" fi