pmaports/main/postmarketos-mkinitfs-hook-netboot/netboot.sh
Mark Hargreaves ac23869e4c
postmarketos-mkinitfs-hook-netboot: new aport (MR 2222)
Co-authored-by: Luca Weiss <luca@z3ntu.xyz>
2022-01-22 13:40:05 +01:00

30 lines
666 B
Bash

#!/bin/sh
# shellcheck disable=SC1091
. /etc/deviceinfo
. ./init_functions.sh
NBD_PORT=9999
NBD_IP=172.16.42.2
setup_usb_network
start_unudhcpd
show_splash /splash-netboot-waiting.ppm.gz
# Attempt to load the kernel module if CONFIG_BLK_DEV_NBD=m
modprobe nbd
# Check that we actually have nbd0 available, otherwise show an error screen.
if [ ! -b /dev/nbd0 ]; then
echo "Failed to get /dev/nbd0, stopping."
show_splash /splash-netboot-error.ppm.gz
pmos_loop_forever
fi
while ! busybox nbd-client $NBD_IP $NBD_PORT /dev/nbd0 -b 512; do
echo "Connection attempt not successful, continuing..."
sleep 1
done
echo "Connected to $NBD_IP!"
mount_subpartitions