fixed indentation

This commit is contained in:
2022-12-17 20:19:03 +01:00
parent 2a05bc8392
commit a33726fba8
22 changed files with 800 additions and 800 deletions

View File

@@ -17,8 +17,8 @@ export DEP_create_vm="upgrade_dist install_pkg"
create_vm()
{
if [[ $WITH_VM != "yes" ]]; then
prnt W "That computer is not configured for virtualisation, nothing to do."
return 0
prnt W "That computer is not configured for virtualisation, nothing to do."
return 0
fi
pkginst virtualbox
@@ -32,60 +32,60 @@ create_vm()
local accel_2d=off
case $VM_OS in
Windows*)
accel_2d=on
;;
Windows*)
accel_2d=on
;;
esac
# Create emty VM
local targetdir=$VM_ROOT/vms/$VM_NAME
vboxmanage createvm --ostype $VM_OS --basefolder $targetdir \
--name $VM_NAME --register
--name $VM_NAME --register
# Give main caracteristics
vboxmanage modifyvm $VM_NAME \
--cpus $VM_CPU --memory $VM_MEM --vram $VM_VID_MEM \
--boot1 $VM_BOOT1 --VM_BOOT2 $VM_BOOT2 --boot3 $VM_BOOT3 \
--nic1 bridged --bridgeadapter1 $VM_IF_BRIDGE \
--accelerate2dvideo $accel_2d \
--clipboard bidirectional --draganddrop disabled
--cpus $VM_CPU --memory $VM_MEM --vram $VM_VID_MEM \
--boot1 $VM_BOOT1 --VM_BOOT2 $VM_BOOT2 --boot3 $VM_BOOT3 \
--nic1 bridged --bridgeadapter1 $VM_IF_BRIDGE \
--accelerate2dvideo $accel_2d \
--clipboard bidirectional --draganddrop disabled
# Add a SATA controler
vboxmanage storagectl $VM_NAME \
--name sata0 --add sata --controller IntelAHCI --bootable on \
--hostiocache on --portcount 6
--name sata0 --add sata --controller IntelAHCI --bootable on \
--hostiocache on --portcount 6
# Create a virtual HDD
vboxmanage createmedium \
--size $VM_DISK_SIZE --variant Fixed --filename $targetdir/$VM_NAME.vdi
--size $VM_DISK_SIZE --variant Fixed --filename $targetdir/$VM_NAME.vdi
# Connect the created HDD to the VM
vboxmanage storageattach $VM_NAME \
--storagectl sata0 --port 1 --device 0 --type hdd \
--medium $targetdir/$VM_NAME.vdi
--storagectl sata0 --port 1 --device 0 --type hdd \
--medium $targetdir/$VM_NAME.vdi
unset targetdir accel_2d
# Add empty DVD
vboxmanage storageattach $VM_NAME --storagectl sata0 --port 2 --device 0 \
--medium emptydrive
--medium emptydrive
# Add shares
local share= i=0
for share in $VM_SHARES_NAME; do
(( i+=1 ))
(( i+=1 ))
local j=0 hostpath=""
for path in $VM_SHARES_PATH; do
(( j+=1 ))
if [[ $i -eq $j ]]; then
hostpath=$path
fi
done
unset j
local j=0 hostpath=""
for path in $VM_SHARES_PATH; do
(( j+=1 ))
if [[ $i -eq $j ]]; then
hostpath=$path
fi
done
unset j
vboxmanage sharedfolder add $VM_NAME \
--name ${VM_SHARES_NAME,,} --hostpath $hostpath
vboxmanage sharedfolder add $VM_NAME \
--name ${VM_SHARES_NAME,,} --hostpath $hostpath
done
unset share i
}
@@ -93,35 +93,35 @@ create_vm()
precheck_create_vm()
{
if [[ $WITH_VM == "yes" ]]; then
if [[ -z $VM_NAME ]]; then
prnt E "The virtual machine must have a name."
die 181
fi
if [[ -z VM_CPU || -z VM_MEM || -z VM_OS || -z VM_ROOT || \
-z VM_BOOT1 || -z VM_BOOT2 || -z VM_BOOT3 || -z VM_VID_MEM ||
-z VM_IF_BRIDGE || -z VM_DISK_SIZE ]]; then
prnt E "A necessary declaration for the virtual machine is absent!"
die 181
else
prnt I "The virtual machine \"$VM_NAME\" will be created in $VM_ROOT..."
fi
if [[ -z $VM_NAME ]]; then
prnt E "The virtual machine must have a name."
die 181
fi
if [[ -z VM_CPU || -z VM_MEM || -z VM_OS || -z VM_ROOT || \
-z VM_BOOT1 || -z VM_BOOT2 || -z VM_BOOT3 || -z VM_VID_MEM ||
-z VM_IF_BRIDGE || -z VM_DISK_SIZE ]]; then
prnt E "A necessary declaration for the virtual machine is absent!"
die 181
else
prnt I "The virtual machine \"$VM_NAME\" will be created in $VM_ROOT..."
fi
local share= i=0 j=0
for share in $VM_SHARES_NAME; do
(( i+=1 ))
done
for share in $VM_SHARES_PATH; do
(( j+=1 ))
done
unset share
if [[ $i -eq $j ]]; then
prnt I "The virtual machine will access $i directories from the host."
else
prnt E "The number of share and path to share is different!"
die 182
fi
local share= i=0 j=0
for share in $VM_SHARES_NAME; do
(( i+=1 ))
done
for share in $VM_SHARES_PATH; do
(( j+=1 ))
done
unset share
if [[ $i -eq $j ]]; then
prnt I "The virtual machine will access $i directories from the host."
else
prnt E "The number of share and path to share is different!"
die 182
fi
else
prnt I "No virtual machine to create."
prnt I "No virtual machine to create."
fi
}