From 766b70c5be1a000e09a159aedd0d2375dee84ded Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 13:59:59 +0200 Subject: [PATCH] prevent globbing when enabling/disabling rpm channels I ran into this when I ran the script from within `/etc/yum.repos.d`: + sh -c 'dnf config-manager --set-disabled docker-ce-*' Error: No matching repo to modify: docker-ce-staging.repo. Took me a bit to understand why the script was failing, and then realized the shell was expanding `docker-ce-*` to filenames in my current directory; ls -l docker-ce-* -rw-r--r--. 1 root root 2027 May 6 09:32 docker-ce-staging.repo This patch quotes the channel name to prevent globbing. Signed-off-by: Sebastiaan van Stijn --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 080f191..f262b70 100755 --- a/install.sh +++ b/install.sh @@ -495,8 +495,8 @@ do_install() { $sh_c "$config_manager --add-repo $repo_file_url" if [ "$CHANNEL" != "stable" ]; then - $sh_c "$config_manager $disable_channel_flag docker-ce-*" - $sh_c "$config_manager $enable_channel_flag docker-ce-$CHANNEL" + $sh_c "$config_manager $disable_channel_flag 'docker-ce-*'" + $sh_c "$config_manager $enable_channel_flag 'docker-ce-$CHANNEL'" fi $sh_c "$pkg_manager makecache" )