Modification mkvm pour s-fog

This commit is contained in:
Corentin Hurtret 2023-01-12 08:45:54 +01:00
parent ca6a1b9513
commit 7f4588c279

View File

@ -1,7 +1,9 @@
#!/bin/bash
ovarelease="2023a"
ovafogrelease="2023a"
ovafile="$HOME/Téléchargements/debian-bullseye-gsb-${ovarelease}.ova"
ovafilefog="$HOME/Téléchargements/debian-buster-${ovafogrelease}.ova"
usage () {
@ -12,27 +14,31 @@ usage () {
}
create_vm () {
nom=$1
if [[ ! -r "${ovafile}" ]]; then
echo "$0 : erreur ouverture fichier ${ovafile} ..."
nom="$1"
nomova=${ovafile}
if [[ "${nom}" == "s-fog" ]] ; then
nomova="${ovafilefog}"
fi
if [[ ! -r "${nomova}" ]]; then
echo "$0 : erreur ouverture fichier ${nomova} ..."
exit 3
fi
vboxmanage import "${ovafile}" --vsys 0 --vmname "${nom}"
vboxmanage import "${nomova}" --vsys 0 --vmname "${nom}"
}
setif () {
VBoxManage modifyvm $1 --nic${2} intnet
VBoxManage modifyvm $1 --intnet${2} $3
VBoxManage modifyvm $1 --nictype${2} 82540EM
VBoxManage modifyvm $1 --cableconnected${2} on
VBoxManage modifyvm $1 --nicpromisc${2} allow-all
VBoxManage modifyvm "$1" --nic"${2}" intnet
VBoxManage modifyvm "$1" --intnet"${2}" "$3"
VBoxManage modifyvm "$1" --nictype"${2}" 82540EM
VBoxManage modifyvm "$1" --cableconnected"${2}" on
VBoxManage modifyvm "$1" --nicpromisc"${2}" allow-all
}
create_if () {
# enp0s3
setif $1 1 $2
setif $1 2 $3
setif "$1" 1 "$2"
setif "$1" 2 "$3"
#(enp0s8)
}
@ -41,7 +47,7 @@ if [[ $# != 1 ]] ; then
usage
fi
vm=$1
vm="$1"
create_vm "${vm}"
if [[ "${vm}" == "s-infra" ]] ; then