pmaports/main/postmarketos-mkinitfs-hook-netboot/netboot.sh
Luca Leonardo Scorcia d64e7f263b
main/postmarketos-mkinitfs-hook-netboot: remove redundant 'ERROR:' prefix
Remove the now redundant 'ERROR:' prefix.

Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8526>
2026-05-11 19:14:26 +00:00

35 lines
948 B
Bash

#!/bin/sh
# shellcheck disable=SC1091
. ./init_functions.sh
. /usr/share/misc/source_deviceinfo
NBD_PORT=9999
NBD_BLOCK_SIZE=${deviceinfo_rootfs_image_sector_size:-512}
setup_usb_network
start_unudhcpd
splash_set_message "Waiting for netboot...\\nhttps://postmarketos.org/netboot"
# 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."
splash_set_error "Failed to initialise netboot\\nhttps://postmarketos.org/netboot"
fail_halt_boot
fi
client_ip="${unudhcpd_client_ip:-172.16.42.2}"
while ! busybox nbd-client "$client_ip" $NBD_PORT /dev/nbd0 -b "$NBD_BLOCK_SIZE"; do
echo "Connection attempt not successful, continuing..."
sleep 1
done
echo "Connected to $client_ip!"
# Show "Loading" splash again when continuing
splash_set_message "Loading..."
mount_subpartitions