From a04c4f552af4600a26847d0518eef095ae213b57 Mon Sep 17 00:00:00 2001 From: crowetic Date: Wed, 16 Apr 2025 19:04:13 +0000 Subject: [PATCH] added multiple new features and fixing of network issues --- vm-tool-setup.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/vm-tool-setup.sh b/vm-tool-setup.sh index e5e2095..70146bb 100755 --- a/vm-tool-setup.sh +++ b/vm-tool-setup.sh @@ -1,6 +1,52 @@ #!/bin/bash -sudo apt update -sudo apt -y upgrade -sudo apt install -y qemu-guest-agent util-linux haveged -sudo fstrim -av + +set -euo pipefail + +echo "=== [1/5] Updating system and installing tools ===" +sudo apt update +sudo apt -y upgrade +sudo apt install -y qemu-guest-agent util-linux haveged ethtool + +echo "=== [2/5] Enabling qemu-guest-agent ===" sudo systemctl enable --now qemu-guest-agent + +echo "=== [3/5] Trimming filesystems ===" +sudo fstrim -av || true + +echo "=== [4/5] Detecting VM network interfaces ===" +NIC_LIST=$(ls /sys/class/net | grep -Ev '^(lo|docker|br|vmbr|tap|veth)' | xargs) + +echo "VM NICs detected: $NIC_LIST" + +echo "=== [5/5] Creating persistent systemd service to disable offloads ===" +SERVICE_FILE="/etc/systemd/system/disable-vm-nic-offloads.service" + +sudo tee "$SERVICE_FILE" > /dev/null <