diskimage-builder/elements/cloud-init-datasources/install.d/05-set-cloud-init-sources
Gregory Haynes dc33f6ddd0 Simple-init should disable cloud-init
Cloud-init and simple-init are not meant to play together. Lets disable
cloud-init if simple-init is installed.

Also guarding cloud-init-datasources against running in an environment
where cloud-init is not installed.

Change-Id: I5bfa9a3e83d3259db2436404034ad58c780de1c9
2015-05-11 16:55:02 +00:00

30 lines
860 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
DIB_CLOUD_INIT_DATASOURCES=${DIB_CLOUD_INIT_DATASOURCES:-""}
if [ -z "$DIB_CLOUD_INIT_DATASOURCES" ] ; then
echo "DIB_CLOUD_INIT_DATASOURCES must be set to a comma-separated list "
echo "of cloud-init data sources you wish to use, ie 'Ec2, NoCloud, ConfigDrive'"
exit 1
fi
if [ -d /etc/cloud/cloud.cfg.d ]; then
# DatasourceNone doesn't exist in Ubuntu 12.04 (Precise)
# which uses cloud-init version 0.6.3
if [ "$(lsb_release -cs)" = 'precise' ] ; then
cat > /etc/cloud/cloud.cfg.d/91-dib-cloud-init-datasources.cfg <<EOF
datasource_list: [ $DIB_CLOUD_INIT_DATASOURCES ]
EOF
else
cat > /etc/cloud/cloud.cfg.d/91-dib-cloud-init-datasources.cfg <<EOF
datasource_list: [ $DIB_CLOUD_INIT_DATASOURCES, None ]
EOF
fi
fi