Sammers
Sammers

Reputation: 1108

Why dnf config-manager --save does not work?

I want to add a rpm repo for my system with dnf config-manager:

# dnf config-manager --add-repo=http://example.com/rpm-repo --setopt=gpgcheck=0 --save
Adding repo from: http://example.com/rpm-repo
# cat /etc/yum.repos.d/example.com_rpm-repo.repo
[example.com_rpm-repo]
name=created by dnf config-manager from http://example.com/rpm-repo
baseurl=http://example.com/rpm-repo
enabled=1

Why the resulted example.com_rpm-repo.repo file does not contain the specified option: gpgcheck=0?

Environment:

# cat /etc/centos-release
CentOS Linux release 8.0.1905 (Core)
# yum list installed | grep dnf
dnf.noarch                          4.0.9.2-5.el8                     @System
dnf-data.noarch                     4.0.9.2-5.el8                     @System
dnf-plugins-core.noarch             4.0.2.2-3.el8                     @BaseOS
dnf-utils.noarch                    4.0.2.2-3.el8                     @BaseOS
libdnf.x86_64                       0.22.5-4.el8                      @System
python3-dnf.noarch                  4.0.9.2-5.el8                     @System
python3-dnf-plugins-core.noarch     4.0.2.2-3.el8                     @BaseOS
python3-libdnf.x86_64               0.22.5-4.el8                      @System

Upvotes: 1

Views: 1739

Answers (1)

Chris Maes
Chris Maes

Reputation: 37832

(sadly) you cannot do this in a single operation. You first need to create the repository, then set the option(s):

dnf config-manager --add-repo=http://example.com/rpm-repo
dnf config-manager --save --setopt=gpgcheck=0 example.com_rpm-repo

yes sadly this means that you need to know the repoid, so this will be slightly complicated to automate into one operation.

Upvotes: 1

Related Questions