From ee58c5b1cc40674d8a320eac4d36e2b33146a860 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Fri, 12 Feb 2016 22:57:58 +0100 Subject: [PATCH] debian-minimal: configurable debootstrap components The debian-minimal element creates /etc/apt/sources.list solely with the 'main' component. I need to add 'non-free' and 'contribs'. I tried to pass them via DIB_DEBIAN_COMPONENTS but it is not recognized. Make debian-minimal to honor DIB_DEBIAN_COMPONENTS. Note that it is comma separated for 'debootstrap', so replace commas with spaces to fit the needs of sources.list. Example usage: DIB_DEBIAN_COMPONENTS='main,non-free,contrib' Will debootstrap with the three components then when debian-minimal is realized pre install a sources.list that has: deb http://example.org/debian jessie main contrib non-free Change-Id: I1dca2e8ffd31044a6b441ccb277298601e62f67c --- elements/debian-minimal/README.rst | 6 ++++++ elements/debian-minimal/pre-install.d/01-debian-apt-update | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/elements/debian-minimal/README.rst b/elements/debian-minimal/README.rst index ead2d232..0625720a 100644 --- a/elements/debian-minimal/README.rst +++ b/elements/debian-minimal/README.rst @@ -11,6 +11,12 @@ not handle changing Packages files well across multiple out of sync mirrors, it is recommended that you choose a single mirror of debian, and pass it in via `DIB_DISTRIBUTION_MIRROR`. +By default only `main` component is used. If `DIB_DEBIAN_COMPONENTS` (comma +separated) from the `debootstrap` element has been set, that list of +components will be used instead. + +Backports are included unless `DIB_RELEASE` is `unstable`. + If necessary, a custom apt keyring and debootstrap script can be supplied to the `debootstrap` command via `DIB_APT_KEYRING` and `DIB_DEBIAN_DEBOOTSTRAP_SCRIPT` respectively. Both options require the diff --git a/elements/debian-minimal/pre-install.d/01-debian-apt-update b/elements/debian-minimal/pre-install.d/01-debian-apt-update index 52fcb547..c9ff345e 100755 --- a/elements/debian-minimal/pre-install.d/01-debian-apt-update +++ b/elements/debian-minimal/pre-install.d/01-debian-apt-update @@ -21,14 +21,17 @@ fi set -eu set -o pipefail +DIB_DEBIAN_COMPONENTS=${DIB_DEBIAN_COMPONENTS:-main} +components=${DIB_DEBIAN_COMPONENTS//,/ } + # We should manage this in a betterer way cat << EOF >/etc/apt/sources.list -deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE main +deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE $components EOF if [ $DIB_RELEASE != unstable ] ; then cat << EOF >>/etc/apt/sources.list -deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-backports main +deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-backports $components EOF fi