debian: simplify the way debian element is called

“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
This commit is contained in:
Gonéri Le Bouder 2014-04-16 17:25:34 +02:00
parent ae9ccc4a23
commit eb26c1a0b1
2 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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