diff --git a/install.sh b/install.sh index f1f6115192..b05900c66a 100755 --- a/install.sh +++ b/install.sh @@ -684,6 +684,7 @@ LVM_TM_COMMANDS_LIB_FILES="src/tm_mad/lvm/tm_clone.sh \ VMWARE_TM_COMMANDS_LIB_FILES="src/tm_mad/vmware/tm_clone.sh \ src/tm_mad/vmware/tm_ln.sh \ src/tm_mad/vmware/tm_mv.sh" + src/tm_mad/vmware/tm_context.sh" VMWARE_TM_SSH_COMMANDS_LIB_FILES="src/tm_mad/vmware-ssh/tm_clone.sh \ src/tm_mad/vmware-ssh/tm_ln.sh" diff --git a/src/tm_mad/vmware/tm_context.sh b/src/tm_mad/vmware/tm_context.sh new file mode 100755 index 0000000000..89137fb04d --- /dev/null +++ b/src/tm_mad/vmware/tm_context.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- +# Copyright 2010, C12G Labs S.L. +# +# This file is part of OpenNebula VMware Drivers. +# +# OpenNebula VMware Drivers is free software: you can redistribute it +# and/or modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation, either version 3 of +# the License, or the hope That it will be useful, but (at your +# option) any later version. +# +# OpenNebula VMware Drivers is distributed in WITHOUT ANY WARRANTY; +# without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License +# along with OpenNebula VMware Drivers . If not, see +# +# -------------------------------------------------------------------------- + +while (( "$#" )); do + if [ "$#" == "1" ]; then + DST=$1 + else + SRC="$SRC $1" + fi + shift +done + + +if [ -z "${ONE_LOCATION}" ]; then + TMCOMMON=/usr/lib/one/mads/tm_common.sh +else + TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh +fi + +. $TMCOMMON + +get_vmdir + +DST_PATH=`arg_path $DST` + +fix_dst_path + +DST_DIR=`dirname $DST_PATH` +ISO_DIR=$DST_DIR/isofiles + +exec_and_log "mkdir -p $ISO_DIR" + +for f in $SRC; do + case $f in + http://*) + exec_and_log "$WGET -O $ISO_DIR $f" + ;; + + *) + exec_and_log "cp -R $f $ISO_DIR" + ;; + esac +done + +exec_and_log "$MKISOFS -o $DST_PATH.iso -J -R $ISO_DIR" + +exec_and_log "rm -rf $ISO_DIR" diff --git a/src/tm_mad/vmware/tm_vmware.conf b/src/tm_mad/vmware/tm_vmware.conf index c7fc099ed3..0de9eeb95e 100644 --- a/src/tm_mad/vmware/tm_vmware.conf +++ b/src/tm_mad/vmware/tm_vmware.conf @@ -20,3 +20,4 @@ MKSWAP = dummy/tm_dummy.sh MKIMAGE = dummy/tm_dummy.sh DELETE = shared/tm_delete.sh MV = vmware/tm_mv.sh +CONTEXT = vmware/tm_context.sh diff --git a/src/tm_mad/vmware/tm_vmware_ssh.conf b/src/tm_mad/vmware/tm_vmware_ssh.conf index e7aa47207f..a71a10b5ce 100644 --- a/src/tm_mad/vmware/tm_vmware_ssh.conf +++ b/src/tm_mad/vmware/tm_vmware_ssh.conf @@ -6,5 +6,5 @@ MKSWAP = ssh/tm_mkswap.sh MKIMAGE = ssh/tm_mkimage.sh DELETE = ssh/tm_delete.sh MV = ssh/tm_mv.sh -CONTEXT = ssh/tm_context.sh +CONTEXT = vmware/tm_context.sh