alpine init script

main
superrob1500 2025-08-31 17:46:10 +02:00
commit 7f2f9fd998
1 changed files with 29 additions and 0 deletions

29
alpine-vm-init.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
#script to auto install dependencies for alpine vms
#v1.0
#enable community repo
sed -i '/community/s/^#//' /etc/apk/repositories
# Check if the uncommenting was successful
if grep -q '^[^#].*community' /etc/apk/repositories; then
echo "Community repository enabled successfully."
else
echo "Failed to enable community repository. Please check the repositories file manually." >&2
exit 1
fi
# Update the package list
echo "Updating package list..."
apk update
#install open-vm-tools and qemu-guest-agent
apk add open-vm-tools open-vm-tools-guestinfo open-vm-tools-deploypkg qemu-guest-agent
#enable services on boot
rc-update add open-vm-tools boot
rc-update add qemu-guest-agent boot
#start services
rc-service open-vm-tools start
rc-service qemu-guest-agent start