public/alpine-vm-init.sh

29 lines
793 B
Bash

#!/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