Skip to content

Commit 477602f

Browse files
committed
fixup! feat(extensions): add netboot extension for full TFTP+NFS boot
1 parent 3022e9b commit 477602f

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

extensions/netboot/netboot.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ function extension_prepare_config__netboot_defaults_and_validate() {
6060
# checks remain safe under `set -u` when no MAC is configured.
6161
declare -g NETBOOT_CLIENT_MAC_NORMALIZED=""
6262
declare -g NETBOOT_TFTP_PREFIX="${NETBOOT_TFTP_PREFIX:-armbian/${LINUXFAMILY}/${BOARD}/${BRANCH}-${RELEASE}}"
63+
# TFTP_PREFIX is appended to the staging root with `mkdir -p`; a `..` segment would
64+
# walk out of it and let an extension scribble onto arbitrary paths under FINALDEST.
65+
case "${NETBOOT_TFTP_PREFIX}" in
66+
*..*) exit_with_error "${EXTENSION}: NETBOOT_TFTP_PREFIX must not contain '..'" "${NETBOOT_TFTP_PREFIX}" ;;
67+
esac
6368

6469
if [[ -n "${NETBOOT_HOSTNAME}" ]]; then
6570
declare -g NETBOOT_NFS_PATH="${NETBOOT_NFS_PATH:-/srv/netboot/rootfs/hosts/${NETBOOT_HOSTNAME}}"
@@ -103,9 +108,10 @@ function extension_prepare_config__netboot_defaults_and_validate() {
103108
# on-host phase of docker builds, before the docker bind-mount).
104109
function _netboot_normalize_export_dir() {
105110
[[ -z "${ROOTFS_EXPORT_DIR}" ]] && return 0
106-
# Already normalized — extension_prepare_config may fire after host_pre_docker_launch
107-
# has already run on the host side.
108-
[[ "${ROOTFS_EXPORT_DIR}" == "${SRC}/output/netboot-export/"* ]] && return 0
111+
# In a docker build host_pre_docker_launch has already normalized the host path
112+
# and remapped ROOTFS_EXPORT_DIR to the container bind-mount target; skip so the
113+
# in-container extension_prepare_config doesn't re-prepend the base and break it.
114+
[[ "${ARMBIAN_RUNNING_IN_CONTAINER:-}" == "yes" ]] && return 0
109115
case "${ROOTFS_EXPORT_DIR}" in
110116
*..*) exit_with_error "${EXTENSION}: ROOTFS_EXPORT_DIR must not contain '..'" "${ROOTFS_EXPORT_DIR}" ;;
111117
esac

0 commit comments

Comments
 (0)