fix: shellcheck error

This commit is contained in:
Seaton Jiang 2022-02-22 23:31:17 +08:00
parent 5c98221f23
commit 4d2c2f21e4
No known key found for this signature in database
GPG Key ID: B79682F6FE8D30E3
2 changed files with 8 additions and 9 deletions

View File

@ -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

View File

@ -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