From f609dd8925fc824f95e6180d2b19ce2c3d72ec68 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 3 Oct 2024 12:56:22 +0200 Subject: [PATCH] quote some variables, and use double-quotes for more readable output I noticed some variables weren't quoted but included parts that could be set through environment variables. Add quotes to those to prevent possible issues, and use double quotes to make the output more readable, similar to what was done in commit 65cca2fde3a7fe72cd6a2d498bfd86c5ff4a9ba1 Before: + TMP_REPO_FILE=/tmp/tmp.gg8DOiskXT + sh -c 'curl -fsSL '\''https://download.docker.com/linux/fedora/docker-ce.repo'\'' | tr -s '\''\n'\'' > '\''/tmp/tmp.gg8DOiskXT'\''' + sh -c 'dnf5 config-manager addrepo --save-filename=docker-ce.repo --overwrite --from-repofile='\''/tmp/tmp.gg8DOiskXT'\''' + sh -c 'rm -f '\''/tmp/tmp.gg8DOiskXT'\''' After: + TMP_REPO_FILE=/tmp/tmp.C89hwiQBFk + sh -c 'curl -fsSL "https://download.docker.com/linux/fedora/docker-ce.repo" | tr -s "\n" > "/tmp/tmp.C89hwiQBFk"' + sh -c 'dnf5 config-manager addrepo --save-filename=docker-ce.repo --overwrite --from-repofile="/tmp/tmp.C89hwiQBFk"' + sh -c 'rm -f "/tmp/tmp.C89hwiQBFk"' Signed-off-by: Sebastiaan van Stijn --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 48b0d6ad..6b71c135 100755 --- a/install.sh +++ b/install.sh @@ -559,14 +559,14 @@ do_install() { fi if command_exists dnf5; then # $sh_c "dnf -y -q --setopt=install_weak_deps=False install dnf-plugins-core" - # $sh_c "dnf5 config-manager addrepo --save-filename=docker-ce.repo --from-repofile='$repo_file_url'" + # $sh_c "dnf5 config-manager addrepo --save-filename=docker-ce.repo --from-repofile=\"$repo_file_url\"" $sh_c "dnf -y -q --setopt=install_weak_deps=False install curl dnf-plugins-core" # FIXME(thaJeztah); strip empty lines as workaround for https://github.com/rpm-software-management/dnf5/issues/1603 TMP_REPO_FILE="$(mktemp --dry-run)" - $sh_c "curl -fsSL '$repo_file_url' | tr -s '\n' > '${TMP_REPO_FILE}'" - $sh_c "dnf5 config-manager addrepo --save-filename=docker-ce.repo --overwrite --from-repofile='${TMP_REPO_FILE}'" - $sh_c "rm -f '${TMP_REPO_FILE}'" + $sh_c "curl -fsSL \"$repo_file_url\" | tr -s \"\n\" > \"${TMP_REPO_FILE}\"" + $sh_c "dnf5 config-manager addrepo --save-filename=docker-ce.repo --overwrite --from-repofile=\"${TMP_REPO_FILE}\"" + $sh_c "rm -f \"${TMP_REPO_FILE}\"" if [ "$CHANNEL" != "stable" ]; then $sh_c "dnf5 config-manager setopt \"docker-ce-*.enabled=0\"" @@ -575,7 +575,7 @@ do_install() { $sh_c "dnf makecache" elif command_exists dnf; then $sh_c "dnf -y -q --setopt=install_weak_deps=False install dnf-plugins-core" - $sh_c "dnf config-manager --add-repo $repo_file_url" + $sh_c "dnf config-manager --add-repo \"$repo_file_url\"" if [ "$CHANNEL" != "stable" ]; then $sh_c "dnf config-manager --set-disabled \"docker-ce-*\"" @@ -584,7 +584,7 @@ do_install() { $sh_c "dnf makecache" else $sh_c "yum -y -q install yum-utils" - $sh_c "yum-config-manager --add-repo $repo_file_url" + $sh_c "yum-config-manager --add-repo \"$repo_file_url\"" if [ "$CHANNEL" != "stable" ]; then $sh_c "yum-config-manager --disable \"docker-ce-*\""