libzypp  17.9.0
Repository Variables

Michael Andres

Repository Variables

Within a .repo or .serivce file, the name and URLs are subject to variable substitution.

Variables are e.g. usefull for related repositories like packman ($releasever), which shall always fit the installed distribution, even after a distribution upgrade. To help performing a distribution upgrade, the value of $releasever can be overwritten in zypper using the –releasever global option. This way you can easily switch all repositories using $releasever to the new version (provided the server layouts did not change and new repos are already available).

The variable expander also supports shell like definition of default and alternate values.

See also
zypp::repo::RepoVarExpand Variable expander

Builtin repository variables

  • $arch - The system's CPU architecture.
  • $basearch - The base architecture of the system. For example, iX86 machines have a base architecture of i386, while AMD64 and Intel64 have x86_64.
  • $releasever - The version of your openSUSE or SUSE Linux. The value is obtained from the /product/version XML-node in /etc/products.d/baseproduct.
  • $releasever_minor
  • $releasever_major - $releasever_major will be set to the leading portion up to (but not including) the 1st dot; $releasever_minor to the trailing portion after the 1st dot. If there's no dot in $releasever, $releasever_major is the same as $releasever and $releasever_minor is empty.

User defined repository variables [requires 'libzypp(repovarexpand) >= 1']

A custom repository variable is defined by creating a file in /etc/zypp/vars.d. The variable name equals the file name. The files first line (up to but not including the newline character) defines the variables value. Valid variable(file) names consist of alphanumeric chars and '_' only.

Variable substitution within an URIs authority [requires 'libzypp(repovarexpand) >= 1.1'] is limited to host and port. Bash style definition of default and alternate values is not supported. No variables can be used in an URIs scheme, user and password.