2013年11月11日 星期一

[VirtualBox] How to change uuid of *.vbox by using script


[VirtualBox] How to change uuid of *.vbox by using script



#!/bin/bash

serial_number1=`vboxmanage internalcommands sethduuid $1.vmdk | awk '{print $4}'`

serial_number2=`vboxmanage internalcommands sethduuid $1.vmdk | awk '{print $4}'`

serial_number3=`vboxmanage internalcommands sethduuid $1.vmdk | awk '{print $4}'`



echo $serial_number



sed -e 's/<Machine uuid="{[a-z0-9-]*/<Machine uuid="{'$serial_number1'/g' -i $1.vbox

sed -e 's/<HardDisk uuid="{[a-z0-9-]*/<HardDisk uuid="{'$serial_number2'/g' -i $1.vbox

sed -e 's/<Image uuid="{[a-z0-9-]*/<Image uuid="{'$serial_number3'/g' -i $1.vbox



Reference:



Related Posts:

0 意見:

張貼留言