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:
parent
ae9ccc4a23
commit
eb26c1a0b1
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eux
|
set -eux
|
||||||
echo upstart >> ${TARGET_ROOT}/.extra-packages
|
cat > ${TARGET_ROOT}/.extra_settings << EOF
|
||||||
echo debian-upstart >> ${TARGET_ROOT}/.distro-name
|
DIB_DEBIAN_ALT_INIT_PACKAGE=upstart
|
||||||
|
EOF
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
set -eu
|
set -eu
|
||||||
if [ -f ${TARGET_ROOT}/.distro-name ] ; then
|
if [ -f ${TARGET_ROOT}/.extra_settings ] ; then
|
||||||
DISTRO_NAME=$(cat ${TARGET_ROOT}/.distro-name)
|
. ${TARGET_ROOT}/.extra_settings
|
||||||
else
|
|
||||||
DISTRO_NAME=debian
|
|
||||||
fi
|
fi
|
||||||
|
DISTRO_NAME=${DISTRO_NAME:-debian}
|
||||||
DIB_RELEASE=${DIB_RELEASE:-unstable}
|
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
|
if [ -n "${DIB_DEBIAN_MIRROR:-}" ]; then
|
||||||
echo "Use of DIB_DEBIAN_MIRROR environment variable to configure mirror is deprecated."
|
echo "Use of DIB_DEBIAN_MIRROR environment variable to configure mirror is deprecated."
|
||||||
echo "Please use DIB_DISTRIBUTION_MIRROR instead."
|
echo "Please use DIB_DISTRIBUTION_MIRROR instead."
|
||||||
@ -38,9 +38,10 @@ if [ -n "$DIB_OFFLINE" ] && [ -f $DEBOOTSTRAP_TARBALL ] ; then
|
|||||||
else
|
else
|
||||||
echo Building new tarball for Debian $DIB_RELEASE ARCH=$ARCH
|
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
|
ADD_PACKAGES=sudo,adduser,locales,openssh-server,file,less,kbd,curl,rsync,bash-completion,linux-image-amd64
|
||||||
if [ -f ${TARGET_ROOT}/.extra-packages ] ; then
|
if [ "$DIB_DEBIAN_ALT_INIT_PACKAGE" != "sysvinit" ]; then
|
||||||
ADD_PACKAGES=${ADD_PACKAGES},$(cat ${TARGET_ROOT}/.extra-packages)
|
ADD_PACKAGES=${ADD_PACKAGES},${DIB_DEBIAN_ALT_INIT_PACKAGE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo sh -c "http_proxy=$http_proxy debootstrap --verbose \
|
sudo sh -c "http_proxy=$http_proxy debootstrap --verbose \
|
||||||
--arch=${ARCH} \
|
--arch=${ARCH} \
|
||||||
--include=${ADD_PACKAGES} \
|
--include=${ADD_PACKAGES} \
|
||||||
@ -75,3 +76,5 @@ LABEL=cloudimg-rootfs / ext4 errors=remount-ro 0 1
|
|||||||
echo Caching debootstrap result in $DEBOOTSTRAP_TARBALL
|
echo Caching debootstrap result in $DEBOOTSTRAP_TARBALL
|
||||||
sudo tar -C $TARGET_ROOT -zcf $DEBOOTSTRAP_TARBALL .
|
sudo tar -C $TARGET_ROOT -zcf $DEBOOTSTRAP_TARBALL .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sudo rm -f ${TARGET_ROOT}/.extra_settings
|
||||||
|
Loading…
Reference in New Issue
Block a user