Compare commits

...

2 Commits

3 changed files with 12 additions and 11 deletions

View File

@ -4,10 +4,10 @@
core_count=$(nproc --all)
# Check if nproc --all returns a numerical value greater than 2
if (( core_count > 1 )); then
echo "System has more than 1 core (nproc --all: $core_count)."
if (( core_count > 2 )); then
echo "System has more than 2 core (nproc --all: $core_count)."
else
echo "Warning: System has only $core_count core)."
echo "The script requires at least two cores"
echo "The script requires at least four cores"
exit 1 # Exit with an error code to indicate the condition is not met
fi

View File

@ -39,14 +39,15 @@ virt-install \
--machine q35 \
--name "$vm_name" \
--boot uefi \
--cpu host-model,topology.sockets=1,topology.cores=2,topology.threads=1 \
--vcpus 2 \
--memory 2048 \
--cpu host-model,topology.sockets=1,topology.cores=2,topology.threads=2 \
--vcpus 4 \
--memory 4096 \
--video virtio \
--channel unix,target.type=virtio,target.name=org.qemu.guest_agent.0 \
--autoconsole none \
--console pty,target.type=virtio \
--sound none \
--network type=user,model=virtio \
--network type=default,model=virtio \
--controller type=virtio-serial \
--controller type=usb,model=none \
--controller type=scsi,model=virtio-scsi \
@ -55,7 +56,7 @@ virt-install \
--rng /dev/urandom,model=virtio \
--disk path=/var/lib/libvirt/images/"$vm_name".img,format=raw,bus=virtio,cache=writeback,size=10 \
--location=https://download.fedoraproject.org/pub/fedora/linux/releases/42/Everything/x86_64/os/ \
--initrd-inject "./dishes/$vm_name".cfg \
--extra-args "inst.ks=file:$vm_name.cfg"
--initrd-inject ./dishes/"$vm_name".cfg \
--extra-args "inst.ks=file:/$vm_name.cfg"
echo "virt-install command executed with VM name: $vm_name"

View File

@ -6,8 +6,8 @@ total_memory=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
# Convert to MiB by dividing by 1024 (since MemTotal is in KiB)
total_memory_mb=$(( total_memory / 1024 ))
if [[ "$total_memory_mb" -lt "2048" ]]; then
echo "Not enough RAM: The system has only ${total_memory_mb}MiB of RAM, but at least 2048 MiB is required."
if [[ "$total_memory_mb" -lt "4096" ]]; then
echo "Not enough RAM: The system has only ${total_memory_mb}MiB of RAM, but at least 4096 is required."
exit 1
else
echo "Sufficient memory available. System has ${total_memory_mb}MiB of RAM."