feat: provision ip-address

This commit is contained in:
Laborratte 5 2026-03-26 11:11:52 +01:00
parent d289f49cfb
commit 8f150a20ef
Signed by: Laborratte5
GPG key ID: 3A30072E35202C02

View file

@ -33,12 +33,27 @@ unmount_temporary () {
rmdir $1
}
provision_network () {
mnt_point=$1
echo "Provision network"
cat > $mnt_handle/network-config <<EOF
network:
version: 2
ethernets:
eth0:
addresses: [$NET_ADDR]
EOF
}
read -e -p "Compressed Image file: " IMG_FILE
read -e -p "SD Card: " SD_CARD
read -e -p "IP-Address with prefix (comma separated): " NET_ADDR
flash_sd "$IMG_FILE" "$SD_CARD"
enlarge_partition "$SD_CARD"
mnt_handle=$(mount_temporary "1")
provision_network $mnt_handle
unmount_temporary $mnt_handle