From 9eb175e440a7aa656ce40f40099631ebab293133 Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Thu, 15 Aug 2019 16:20:21 +0200 Subject: [PATCH] Allow extra repositories to be added to images This patch adds option DIB_YUM_MINIMAL_EXTRA_REPOS to yum-minimal to allow DIB users to include extra repositories to their final image. Change-Id: I89549f4b0f4c9470143b5064817acab5043e31c5 --- diskimage_builder/elements/yum-minimal/README.rst | 4 ++++ diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/diskimage_builder/elements/yum-minimal/README.rst b/diskimage_builder/elements/yum-minimal/README.rst index 7d1889a20..2c4d95f99 100644 --- a/diskimage_builder/elements/yum-minimal/README.rst +++ b/diskimage_builder/elements/yum-minimal/README.rst @@ -18,3 +18,7 @@ If you wish to build from specific mirrors, set files to use during bootstrap and build. The repo files should be named with a prefix ``dib-mirror-`` and will be removed from the final image. + +If you wish to include extra repositories, set ``DIB_YUM_MINIMAL_EXTRA_REPOS`` +to a directory with the ``.repo`` files. The repo files will not be removed +from the final image. diff --git a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot index 330babd3d..f22ce40fd 100755 --- a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot +++ b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot @@ -128,6 +128,10 @@ function _install_repos { $TARGET_ROOT/etc/yum.repos.d/ fi + if [[ -n ${DIB_YUM_MINIMAL_EXTRA_REPOS:-} ]]; then + sudo cp ${DIB_YUM_MINIMAL_EXTRA_REPOS}/* \ + $TARGET_ROOT/etc/yum.repos.d/ + fi } # _install_pkg_manager packages...