blob: 65290ccbfde6be716d56291982716ebf806c581c [file] [log] [blame]
#!/bin/bash
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
### run bootserver for netbooting
## usage: fx netboot [extra bootserver arguments]
set -e
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
fx-config-read
name_args=()
name="$(get-device-name)"
if [[ -n "$name" ]]; then
name_args+=("-n" "${name}")
fi
tmpdir="${FUCHSIA_BUILD_DIR}.netboot.tmp"
mkdir "${tmpdir}"
trap 'rm -rf "${tmpdir}"' EXIT
cp "${FUCHSIA_BUILD_DIR}/netboot.sh" "${tmpdir}"
"${ZIRCON_TOOLS_DIR}/zbi" -o "${tmpdir}/netboot.zbi" "${FUCHSIA_BUILD_DIR}/netboot.zbi" "--entry=data/ssh/authorized_keys=${FUCHSIA_DIR}/.ssh/authorized_keys"
"${tmpdir}/netboot.sh" "${name_args[@]}" "$@"