1
0
mirror of https://github.com/rancher/os.git synced 2025-07-04 02:26:13 +00:00

use an arg instead of a magic location for a user supplied cloud-config

This commit is contained in:
Ivan Mikushin 2015-04-29 10:50:21 +05:00
parent 3511343f46
commit c5676987a9

View File

@ -17,6 +17,7 @@ INITRD_TMP=${BUILD}/$(sha1sum ${INITRD} | awk '{print $1}')
INITRD_CURRENT=${BUILD}/initrd-current INITRD_CURRENT=${BUILD}/initrd-current
INITRD_TEST=${BUILD}/initrd.test INITRD_TEST=${BUILD}/initrd.test
USER_DATA=cloud-init/openstack/latest/user_data USER_DATA=cloud-init/openstack/latest/user_data
CLOUD_CONFIG=$(readlink -f "$1") || :
if [[ ! -e ${KERNEL} || ! -e ${INITRD} ]]; then if [[ ! -e ${KERNEL} || ! -e ${INITRD} ]]; then
echo "Failed to find ${KERNEL} or ${INITRD}" 1>&2 echo "Failed to find ${KERNEL} or ${INITRD}" 1>&2
@ -56,8 +57,8 @@ fi
mkdir -p $(dirname $USER_DATA) mkdir -p $(dirname $USER_DATA)
if [ -e ../../tmp/cloud-config.yml ]; then if [ -n "$CLOUD_CONFIG" ]; then
cat ../../tmp/cloud-config.yml > ${USER_DATA} cat ${CLOUD_CONFIG} > ${USER_DATA}
else else
echo "#cloud-config" > ${USER_DATA} echo "#cloud-config" > ${USER_DATA}
echo "ssh_authorized_keys:" >> ${USER_DATA} echo "ssh_authorized_keys:" >> ${USER_DATA}