2014-05-26 21:35:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2014-06-11 23:03:47 +00:00
|
|
|
# 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
|
2014-05-26 21:35:57 +00:00
|
|
|
datasource_list: [ $DIB_CLOUD_INIT_DATASOURCES, None ]
|
|
|
|
EOF
|
2014-06-11 23:03:47 +00:00
|
|
|
fi
|