#! /bin/bash
# This file is part of Cockpit.
#
# Copyright (C) 2015 Red Hat, Inc.
#
# Cockpit is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Cockpit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see .
set -e
# create the cloud-init iso
init_dir=$(mktemp -d)
meta_data="$init_dir/meta-data"
user_data="$init_dir/user-data"
iso_image="cloud-init.iso"
vm_user="root"
vm_pass="foobar"
key_pub=`cat identity.pub`
host_key=`sed 's/^/ /' host_key`
host_key_pub=`cat host_key.pub`
mkdir -p $init_dir
# We don't want to hardcode values:
# local-hostname: we want multiple instances of the vm to run in parallel
# instance-id: cloud-init skips some init stuff if this is constant (e.g. runcmd)
cat >$meta_data <$user_data <