From 17572141969258d589a65f0438fa050fa6fb98ee Mon Sep 17 00:00:00 2001 From: Kiall Mac Innes Date: Sat, 26 Apr 2014 14:21:55 +0100 Subject: [PATCH] Debian: Support additional debootstrap arguments Add support for supplying a custom keyring and debootstrap script using two new environment variables: * DIB_DEBIAN_KEYRING - Path to a gpg keyring. * DIB_DEBIAN_DEBOOTSTRAP_SCRIPT - Path to a alternative debootstrap script. Change-Id: I42e8832b435b8a77b0681b5bc9d9332bbe860cd5 --- elements/debian/README.md | 5 +++++ elements/debian/root.d/08-debootstrap | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/elements/debian/README.md b/elements/debian/README.md index eab538569..c8b72b433 100644 --- a/elements/debian/README.md +++ b/elements/debian/README.md @@ -7,6 +7,11 @@ 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`. +If necessary, a custom apt keyring and debootstrap script can be +supplied to the `debootstrap` command via `DIB_DEBIAN_KEYRING` and +`DIB_DEBIAN_DEBOOTSTRAP_SCRIPT` respectively. Both options require the +use of absolute rather than relative paths. + Use of this element will also require the tool 'debootstrap' to be available on your system. It should be available on Ubuntu, Debian, and Fedora. diff --git a/elements/debian/root.d/08-debootstrap b/elements/debian/root.d/08-debootstrap index ca9fa89eb..d75cfba85 100755 --- a/elements/debian/root.d/08-debootstrap +++ b/elements/debian/root.d/08-debootstrap @@ -38,12 +38,20 @@ if [ -n "$DIB_OFFLINE" ] && [ -f $DEBOOTSTRAP_TARBALL ] ; then else echo Building new tarball for Debian $DIB_RELEASE ARCH=$ARCH ADD_PACKAGES=sudo,adduser,locales,openssh-server,file,less,kbd,curl,rsync,bash-completion,linux-image-amd64 + + KEYRING_OPT= + if [ -n "${DIB_DEBIAN_KEYRING:-}" ] ; then + KEYRING_OPT="--keyring=${DIB_DEBIAN_KEYRING}" + fi + sudo sh -c "http_proxy=$http_proxy debootstrap --verbose \ --arch=${ARCH} \ --include=${ADD_PACKAGES} \ + $KEYRING_OPT \ $DIB_RELEASE \ $TARGET_ROOT \ - $DIB_DISTRIBUTION_MIRROR" + $DIB_DISTRIBUTION_MIRROR \ + ${DIB_DEBIAN_DEBOOTSTRAP_SCRIPT:-}" echo "Customizing result for cloud use" apt_get_bp_extra_opts=