list-images: add --datadir override for e.g. custom repositories
This commit adds a `--datadir` override that allows overriding the default search paths for e.g. the custom repositories. In practise only repository overrides are supported because that is the only data stored there.
This commit is contained in:
parent
56f9c6969c
commit
2719f3f727
6 changed files with 54 additions and 14 deletions
|
|
@ -8,14 +8,24 @@ import (
|
|||
// that we keep this in sync
|
||||
// XXX2: means we need to depend on osbuild-composer-common or a new rpm
|
||||
// that provides the relevant packages *or* we use go:embed (cf images#1038)
|
||||
var repositoryConfigs = []string{
|
||||
//
|
||||
// defaultDataDirs contains the default search paths to look for repository
|
||||
// data. Note that the repositories are under a repositories/ sub-directory
|
||||
// and contain a bunch of json files of the form "$distro_$version".json
|
||||
// (but that is an implementation detail that the "images" library takes
|
||||
// care of).
|
||||
var defaultDataDirs = []string{
|
||||
"/etc/osbuild-composer",
|
||||
"/usr/share/osbuild-composer",
|
||||
}
|
||||
|
||||
var newRepoRegistry = func() (*reporegistry.RepoRegistry, error) {
|
||||
// TODO: add a extraReposPaths here so that users can do
|
||||
// "ibuilder --repositories ..." to add a custom path(s)
|
||||
var newRepoRegistry = func(dataDir string) (*reporegistry.RepoRegistry, error) {
|
||||
var dataDirs []string
|
||||
if dataDir != "" {
|
||||
dataDirs = []string{dataDir}
|
||||
} else {
|
||||
dataDirs = defaultDataDirs
|
||||
}
|
||||
|
||||
return reporegistry.New(repositoryConfigs)
|
||||
return reporegistry.New(dataDirs)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue