Init Alpine 3.20 at patch 1
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env sh
|
||||
set -ex
|
||||
|
||||
# Enables packages like "sudo"
|
||||
sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories
|
||||
|
||||
# Install bare minimal packages
|
||||
apk add curl efibootmgr openssh sudo virt-what
|
||||
|
||||
rc-update add sshd default
|
||||
|
||||
# Configure systems
|
||||
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant-nopasswd
|
||||
echo 'Defaults !requiretty' >> /etc/sudoers
|
||||
sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config
|
||||
cat > /etc/ssh/sshd_config.d/10-vagrant-insecure-rsa-key.conf <<EOF
|
||||
# For now the vagrant insecure key is an rsa key
|
||||
# https://github.com/hashicorp/vagrant/issues/11783
|
||||
PubkeyAcceptedKeyTypes=+ssh-rsa
|
||||
EOF
|
||||
ssh-keygen -A
|
||||
|
||||
# Create and configure the vagrant user
|
||||
adduser vagrant -D
|
||||
# Add the vagrant user to the `wheel` group
|
||||
addgroup vagrant wheel
|
||||
[ -d /home/vagrant ] || exit 1
|
||||
echo "vagrant:vagrant" | chpasswd
|
||||
echo "root:vagrant" | chpasswd
|
||||
|
||||
# Do host-specific things
|
||||
virt="$(virt-what)"
|
||||
# Values I've found so far
|
||||
# "microsoft" == Hyper-V
|
||||
# "oracle" == VirtualBox
|
||||
# "KVM" == KVM/Qemu
|
||||
case "${virt}" in
|
||||
microsoft | hyperv)
|
||||
apk add hvtools
|
||||
rc-update add hv_fcopy_daemon
|
||||
rc-update add hv_kvp_daemon
|
||||
rc-update add hv_vss_daemon
|
||||
target="0001" # Placeholder for now
|
||||
;;
|
||||
kvm | qemu)
|
||||
apk add qemu-guest-agent
|
||||
rc-update add qemu-guest-agent
|
||||
target="$(efibootmgr | grep 'Misc' | awk '{print $1}' | sed -E 's/[^0-9]//g')"
|
||||
;;
|
||||
virtualbox*)
|
||||
apk add virtualbox-guest-additions
|
||||
rc-update add virtualbox-guest-additions boot
|
||||
target="$(efibootmgr | grep 'VBOX HARD' | awk '{print $1}' | sed -E 's/[^0-9]//g')"
|
||||
;;
|
||||
esac
|
||||
|
||||
efibootmgr --bootnext "${target}"
|
||||
Reference in New Issue
Block a user