For example, you could take a look at how to handle the stdin from vmm/kvm/restore
script one/restore at master · OpenNebula/one · GitHub
In your case, if the stdin stream is base64 encoded, you need to just read it with cat
and use xpath.rb to do the decode to raw XML the following sample should work
XPATH="/var/lib/one/remotes/datastore/xpath.rb --stdin"
TEMPLATE="$(cat)"
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($XPATH -b $TEMPLATE '/VM/ID')
VM_ID="${XPATH_ELEMENTS[j++]}"
Hope this helps.
Best Regards,
Anton Todorov