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
This commit is contained in:
Antoine Musso 2016-02-12 22:57:58 +01:00
parent 6f6a096d94
commit ee58c5b1cc
2 changed files with 11 additions and 2 deletions

View File

@ -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, mirrors, it is recommended that you choose a single mirror of debian,
and pass it in via `DIB_DISTRIBUTION_MIRROR`. 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 If necessary, a custom apt keyring and debootstrap script can be
supplied to the `debootstrap` command via `DIB_APT_KEYRING` and supplied to the `debootstrap` command via `DIB_APT_KEYRING` and
`DIB_DEBIAN_DEBOOTSTRAP_SCRIPT` respectively. Both options require the `DIB_DEBIAN_DEBOOTSTRAP_SCRIPT` respectively. Both options require the

View File

@ -21,14 +21,17 @@ fi
set -eu set -eu
set -o pipefail set -o pipefail
DIB_DEBIAN_COMPONENTS=${DIB_DEBIAN_COMPONENTS:-main}
components=${DIB_DEBIAN_COMPONENTS//,/ }
# We should manage this in a betterer way # We should manage this in a betterer way
cat << EOF >/etc/apt/sources.list cat << EOF >/etc/apt/sources.list
deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE main deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE $components
EOF EOF
if [ $DIB_RELEASE != unstable ] ; then if [ $DIB_RELEASE != unstable ] ; then
cat << EOF >>/etc/apt/sources.list cat << EOF >>/etc/apt/sources.list
deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-backports main deb $DIB_DISTRIBUTION_MIRROR $DIB_RELEASE-backports $components
EOF EOF
fi fi