From: Serge Hallyn Date: Tue, 31 Jul 2012 14:04:33 +0000 (+0200) Subject: Description: Fix handling of user-data in ubuntu-cloud template X-Git-Tag: lxc-0.8.0~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a0f7f3c707bf713f35382eaabc54395d2b36b12;p=thirdparty%2Flxc.git Description: Fix handling of user-data in ubuntu-cloud template Signed-off-by: Ben Howard Signed-off-by: Serge Hallyn Signed-off-by: Daniel Lezcano --- diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in index 805f5ae42..79d10c8d1 100644 --- a/templates/lxc-ubuntu-cloud.in +++ b/templates/lxc-ubuntu-cloud.in @@ -117,7 +117,7 @@ EOF return 0 } -options=$(getopt -o a:hp:r:n:Fi:CLS:T:ds: -l arch:,help,path:,release:,name:,flush-cache,hostid:,auth-key:,cloud,no_locales,tarball:,debug,stream: -- "$@") +options=$(getopt -o a:hp:r:n:Fi:CLS:T:ds: -l arch:,help,path:,release:,name:,flush-cache,hostid:,auth-key:,cloud,no_locales,tarball:,debug,stream:,userdata: -- "$@") if [ $? -ne 0 ]; then usage $(basename $0) exit 1 @@ -207,6 +207,11 @@ if [ "$stream" != "daily" -a "$stream" != "released" ]; then exit 1 fi +if [ -n "$userdata" -a ! -f "$userdata" ]; then + echo "Userdata does not exist" + exit 1 +fi + if [ -z "$path" ]; then echo "'path' parameter is required" exit 1 @@ -322,8 +327,9 @@ EOF echo "Inserted SSH public key from $auth_key into /home/ubuntu/.ssh/authorized_keys" fi - if [ ! -f $userdata ]; then - cp $userdata $data_d/user-data + if [ -f "$userdata" ]; then + echo "Using custom user-data" + cp $userdata $seed_d/user-data else if [ -z "$MIRROR" ]; then @@ -337,7 +343,6 @@ apt-mirror: $MIRROR manage_etc_hosts: localhost locale: $(/usr/bin/locale | awk -F= '/LANG=/ {print$NF}') EOF - fi chroot $rootfs /usr/sbin/usermod -U ubuntu