blob: 2345554641cba4d917f21f83a2f478caca933833 [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.
#### CATEGORY=Other
### 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/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
keys_args=()
if [ "${include_keys}" == 1 ]; then
fx-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"
keys_args+=(-zbi "${FUCHSIA_BUILD_DIR}/fuchsia-extra-keys.zbi")
fi
"${FUCHSIA_BUILD_DIR}/host-tools/make-fuchsia-vol" "${keys_args[@]}" "${fwd_args[@]}"