-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhetzner-sno-provision-host.sh
executable file
·28 lines (19 loc) · 1.09 KB
/
hetzner-sno-provision-host.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# credit: https://github.com/palonsoro/hetzner-sno-provision-host
# WARNING: This script assumes that
# - You have wiped the main hard drives as required
# - You are providing the right network configuration in the assisted installer (using nmstate file is recommended)
set -euo pipefail
IPXE_SCRIPT_URL="${1}"
curl -f -s -o discovery_ipxe_script.txt "${IPXE_SCRIPT_URL}"
echo 'This script is meant to be run in the rescue environment to provision the Hetzner node so it can be discovered by assisted installer'
# Set right defaults for kexec-tools and install it
echo kexec-tools kexec-tools/use_grub_config select false | debconf-set-selections
echo kexec-tools kexec-tools/load_kexec select true | debconf-set-selections
apt-get install -y kexec-tools
INITRD_URL="$(awk '/^initrd/{print $NF}' discovery_ipxe_script.txt)"
KERNEL_URL="$(awk '/^kernel/{print $2}' discovery_ipxe_script.txt)"
KERNEL_CMDLINE="$(grep '^kernel' discovery_ipxe_script.txt | cut -d' ' -f 3-)"
wget -O kernel "${KERNEL_URL}"
wget -O initrd "${INITRD_URL}"
kexec kernel --initrd=initrd --append="${KERNEL_CMDLINE}"