diff options
Diffstat (limited to 'os-plugins/plugins/virtualbox/files/run-virt.include')
-rw-r--r-- | os-plugins/plugins/virtualbox/files/run-virt.include | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include index b2c55c0d..119b1e16 100644 --- a/os-plugins/plugins/virtualbox/files/run-virt.include +++ b/os-plugins/plugins/virtualbox/files/run-virt.include @@ -340,19 +340,21 @@ if [ ${diskless} -eq 1 ]; then sed -i "/<!-- PLEASE DO NOT REMOVE THIS COMMENT!!! -->/d" ${machconfig} fi -# add ssh port if Linux26* and NAT -if echo "${vmostype}" | grep -q "Linux26" && [ "${network_kind}" = "NAT" ]; then - vmsshport="220${VM_ID}" - extradataitem='<ExtraDataItem name="VBoxInternal/Devices' \ - extradataitem="${extradataitem}/${network_card}/0/LUN#0/Config/ssh/" - extradataguestport='GuestPort" value="22"/>' - extradatahostport="HostPort\" value=\"${vmsshport}\"/>" - extradataprotocol='Protocol" value="TCP"/>' - sed -i "s,</ExtraData>, ${extradataitem}${extradataguestport}\n\ - ${extradataitem}${extradatahostport}\n\ - ${extradataitem}${extradataprotocol}\n\ - </ExtraData>," "${machconfig}" - writelog "\tGuest SSH port:\t\t${vmsshport}" +# define redirects +if [ -n "${redirects}" ]; then + (( i=1 )) + while [ ${i} -le ${redirects} ]; do + extradataitem='<ExtraDataItem name="VBoxInternal/Devices' + extradataitem="${extradataitem}/${network_card}/0/LUN#0/Config" + extradataitem="${extradataitem}/${redirect_name[$i]}/" + extradataprotocol="Protocol\" value=\"${redirect_proto[$i]}\"/>" + extradatahostport="HostPort\" value=\"${redirect_hport[$i]}\"/>" + extradataguestport="GuestPort\" value=\"${redirect_gport[$i]}\"/>" + sed -i "s,</ExtraData>, ${extradataitem}${extradataguestport}\n\ + ${extradataitem}${extradatahostport}\n\ + ${extradataitem}${extradataprotocol}\n\ + </ExtraData>," "${machconfig}" + writelog "\tGuest ${redirect_name[$i]} port:\t\t${redirect_hport[$i]}" fi ################################################################################ |