From eb26c1a0b12c78180a30edf5ff61b3dc246d9557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Wed, 16 Apr 2014 17:25:34 +0200 Subject: [PATCH] debian: simplify the way debian element is called MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “debian” element now source the ${TARGET_ROOT}/.extra_settings file. We can use this file to adjust its behavior and specifiy what init system should be used. Change-Id: Id57ce879341184a57851d2578cf70978f409a48e --- .../debian-upstart/root.d/05-debian-upstart | 5 +++-- elements/debian/root.d/08-debootstrap | 17 ++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/elements/debian-upstart/root.d/05-debian-upstart b/elements/debian-upstart/root.d/05-debian-upstart index 5e012bfc..32eb199b 100755 --- a/elements/debian-upstart/root.d/05-debian-upstart +++ b/elements/debian-upstart/root.d/05-debian-upstart @@ -1,4 +1,5 @@ #!/bin/bash set -eux -echo upstart >> ${TARGET_ROOT}/.extra-packages -echo debian-upstart >> ${TARGET_ROOT}/.distro-name +cat > ${TARGET_ROOT}/.extra_settings << EOF +DIB_DEBIAN_ALT_INIT_PACKAGE=upstart +EOF diff --git a/elements/debian/root.d/08-debootstrap b/elements/debian/root.d/08-debootstrap index d33b3a4f..975bf1d0 100755 --- a/elements/debian/root.d/08-debootstrap +++ b/elements/debian/root.d/08-debootstrap @@ -16,13 +16,13 @@ # under the License. # set -eu -if [ -f ${TARGET_ROOT}/.distro-name ] ; then - DISTRO_NAME=$(cat ${TARGET_ROOT}/.distro-name) -else - DISTRO_NAME=debian +if [ -f ${TARGET_ROOT}/.extra_settings ] ; then + . ${TARGET_ROOT}/.extra_settings fi +DISTRO_NAME=${DISTRO_NAME:-debian} DIB_RELEASE=${DIB_RELEASE:-unstable} -DEBOOTSTRAP_TARBALL=$DIB_IMAGE_CACHE/debootstrap-${DISTRO_NAME}-${DIB_RELEASE}-${ARCH}.tar.gz +DIB_DEBIAN_ALT_INIT_PACKAGE=${DIB_DEBIAN_ALT_INIT_PACKAGE:-sysvinit} +DEBOOTSTRAP_TARBALL=$DIB_IMAGE_CACHE/debootstrap-${DISTRO_NAME}-${DIB_DEBIAN_ALT_INIT_PACKAGE}-${DIB_RELEASE}-${ARCH}.tar.gz if [ -n "${DIB_DEBIAN_MIRROR:-}" ]; then echo "Use of DIB_DEBIAN_MIRROR environment variable to configure mirror is deprecated." echo "Please use DIB_DISTRIBUTION_MIRROR instead." @@ -38,9 +38,10 @@ 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 - if [ -f ${TARGET_ROOT}/.extra-packages ] ; then - ADD_PACKAGES=${ADD_PACKAGES},$(cat ${TARGET_ROOT}/.extra-packages) + if [ "$DIB_DEBIAN_ALT_INIT_PACKAGE" != "sysvinit" ]; then + ADD_PACKAGES=${ADD_PACKAGES},${DIB_DEBIAN_ALT_INIT_PACKAGE} fi + sudo sh -c "http_proxy=$http_proxy debootstrap --verbose \ --arch=${ARCH} \ --include=${ADD_PACKAGES} \ @@ -75,3 +76,5 @@ LABEL=cloudimg-rootfs / ext4 errors=remount-ro 0 1 echo Caching debootstrap result in $DEBOOTSTRAP_TARBALL sudo tar -C $TARGET_ROOT -zcf $DEBOOTSTRAP_TARBALL . fi + +sudo rm -f ${TARGET_ROOT}/.extra_settings