mirror of
https://github.com/rancher/os.git
synced 2025-07-01 17:21:50 +00:00
Merge pull request #238 from imikushin/run-cloud-config
./scripts/run: provision tmp/cloud-config.yml as cloud-config
This commit is contained in:
commit
5eeba6e070
52
scripts/run
52
scripts/run
@ -18,6 +18,27 @@ 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
|
||||||
|
|
||||||
|
while [ "$#" -gt 0 ]; do
|
||||||
|
case $1 in
|
||||||
|
--append)
|
||||||
|
shift 1
|
||||||
|
QEMU_APPEND="${QEMU_APPEND} $1"
|
||||||
|
;;
|
||||||
|
--cloud-config)
|
||||||
|
shift 1
|
||||||
|
CLOUD_CONFIG=$(readlink -f "$1") || :
|
||||||
|
if [ ! -f ${CLOUD_CONFIG} ]; then
|
||||||
|
echo No such file: "'"${CLOUD_CONFIG}"'" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift 1
|
||||||
|
done
|
||||||
|
|
||||||
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
|
||||||
exit 1
|
exit 1
|
||||||
@ -56,26 +77,17 @@ fi
|
|||||||
|
|
||||||
mkdir -p $(dirname $USER_DATA)
|
mkdir -p $(dirname $USER_DATA)
|
||||||
|
|
||||||
echo "#cloud-config" > ${USER_DATA}
|
if [ -n "$CLOUD_CONFIG" ]; then
|
||||||
echo "ssh_authorized_keys:" >> ${USER_DATA}
|
cat ${CLOUD_CONFIG} > ${USER_DATA}
|
||||||
for i in ${HOME}/.ssh/*.pub; do
|
else
|
||||||
if [ -e $i ]; then
|
echo "#cloud-config" > ${USER_DATA}
|
||||||
echo " - $(<$i)" >> ${USER_DATA}
|
echo "ssh_authorized_keys:" >> ${USER_DATA}
|
||||||
fi
|
for i in ${HOME}/.ssh/*.pub; do
|
||||||
done
|
if [ -e $i ]; then
|
||||||
|
echo " - $(<$i)" >> ${USER_DATA}
|
||||||
while [ "$#" -gt 0 ]; do
|
fi
|
||||||
case $1 in
|
done
|
||||||
--append)
|
fi
|
||||||
shift 1
|
|
||||||
QEMU_APPEND="${QEMU_APPEND} $1"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift 1
|
|
||||||
done
|
|
||||||
|
|
||||||
qemu-system-x86_64 -serial stdio \
|
qemu-system-x86_64 -serial stdio \
|
||||||
-kernel ${KERNEL} \
|
-kernel ${KERNEL} \
|
||||||
|
Loading…
Reference in New Issue
Block a user