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 <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn committed 2023-05-08 12:52:09 +02:00
1 parent 24bb4ae8a0
commit 766b70c5be
1 file changed
+2 -2
+2 -2
View File
@@ -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"
)