Skip to content

tdnf‐config: configuration tool for tdnf

Oliver Kurth edited this page Nov 10, 2023 · 1 revision

tdnf-config is a configuration tool for tdnf to edit the main and repository configurations.

The general syntax is: tdnf-config edit|create|get|remove|removerepo|dump main|<repo> [-c|--config <file>][-f|--file <file>][-j|--json]

Commands

edit

Syntax: edit main|<repo> [[key=value]...]

Change an existing config file or repo configuration. Example: tdnf-config edit photon enabled=1

Multiple variables can be specified: tdnf-config edit photon enabled=1 gpgcheck=1

create

Syntax: create main|<repo> [[key=value]...]

Create a new repository configuration. Config options can be specified at the same time. Example:

tdnf-config create foo baseurl=http://foo.bar.com enabled=1

This would generate this repo config:

# cat /etc/yum.repos.d/foo.repo 
[foo]
baseurl = http://foo.bar.com
enabled = 1

get

Syntax: get main|<repo> key

Retrieve a value. Example:

# tdnf-config get main clean_requirements_on_remove gpgcheck
0

remove

Syntax: remove main|<repo> key

Remove an entry.

removerepo

Syntax: removerepo <repo>

Example: tdnf-config removerepo foo

dump

Syntax: dump main|<repo>

Dump contents of a repo config or the main config. Example:

# ./bin/tdnf-config dump photon       
[photon]
name = VMware Photon Linux $releasever ($basearch)
baseurl = https://packages.vmware.com/photon/$releasever/photon_$releasever_$basearch
gpgkey = file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY-4096
gpgcheck = 1
enabled = 1
skip_if_unavailable = 1
skip_md_filelists = 1

Useful here is the -j option for json output. The output is compact, use jq for pretty output:

# ./bin/tdnf-config -j dump photon | jq .
{
  "photon": {
    "name": "VMware Photon Linux $releasever ($basearch)",
    "baseurl": "https://packages.vmware.com/photon/$releasever/photon_$releasever_$basearch",
    "gpgkey": "file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY-4096",
    "gpgcheck": "1",
    "enabled": "1",
    "skip_if_unavailable": "1",
    "skip_md_filelists": "1",
    "foo": "bar"
  }
}

Options

-c|--config

Specify the main config file (default is /etc/tdnf/tdnf.conf). This is used to find the directory for repo configs if specified.

-f|--file

Specify the file to be used for the repo configuration. By default, for existing repos, all *.repo files in the repo config dir (/etc/yum.repos.d by default)will be searched for a matching repo. For creating a repo, a new file with the name repo id plus the extension .repo will be created.

-j|--json

Applies to the dump command. Format the output in json (compact) format.