1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Feature #1222: Fix context scripts with variable number of arguments.

This commit is contained in:
Jaime Melis 2012-04-24 15:44:58 +02:00
parent 06a5328565
commit 65ecb979d4

View File

@ -23,13 +23,19 @@
# - vmid is the id of the VM
# - 0 is the target datastore (system)
while (( "$#" )); do
if [ "$#" == "1" ]; then
DST=$1
i=1
for arg in "$@"; do
if [ $i -eq $# ]; then
DS_ID="$arg"
elif [ $i -eq $(($#-1)) ]; then
VM_ID="$arg"
elif [ $i -eq $(($#-2)) ]; then
DST="$arg"
else
SRC="$SRC $1"
SRC="$SRC $arg"
fi
shift
let i=i+1
done
if [ -z "${ONE_LOCATION}" ]; then