blob: 14548b1a3fb7231bd11749d1b0d243d7e8788b4f [file] [log] [blame]
#!/bin/bash
# Copyright 2017 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.
### build a fuchsia persistent disk
## usage: fx make-fuchsia-vol [-include-keys]
## -include-keys add the keys from $FUCHSIA_DIR/.ssh/authorized_keys
## to the Zircon ZBI
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../lib/vars.sh || exit $?
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../lib/image_build_vars.sh || exit $?
fx-config-read
fwd_args=()
include_keys=0
while (($#)); do
case "$1" in
-include-keys)
include_keys=1
;;
*)
fwd_args+=("$1")
;;
esac
shift
done
if [ "${include_keys}" == 1 ]; then
"${ZIRCON_TOOLS_DIR}/zbi" -o "${FUCHSIA_BUILD_DIR}/fuchsia-extra-keys.zbi" \
"${FUCHSIA_BUILD_DIR}/${IMAGE_ZIRCONA_ZBI}" --replace \
--entry "data/ssh/authorized_keys=${FUCHSIA_DIR}/.ssh/authorized_keys"
fi
"${FUCHSIA_BUILD_DIR}/tools/make-fuchsia-vol" -zbi "${FUCHSIA_BUILD_DIR}/fuchsia-extra-keys.zbi" "${fwd_args[@]}"