diff options
author | 2017-05-10 23:47:17 +0200 | |
---|---|---|
committer | 2017-05-10 23:47:17 +0200 | |
commit | f32036a025d8ae7e6ef02aca8b080e5bca60fc11 (patch) | |
tree | 32f9cf3f7ba6251096602e8f9f3510b6ef24f3a0 | |
parent | 7a305b6779b7cbf7ddf22dbaaf2c168b4c4697aa (diff) |
scripts_netboot: adjust run_xnbd_server to handle images for multiple machines
Change-Id: I546301377d28101a47e8124cbad7ca6682fe47b7
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
-rwxr-xr-x | INSTALL/tools/scripts_netboot/run_xnbd_server | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/INSTALL/tools/scripts_netboot/run_xnbd_server b/INSTALL/tools/scripts_netboot/run_xnbd_server index 190301d..92dd98c 100755 --- a/INSTALL/tools/scripts_netboot/run_xnbd_server +++ b/INSTALL/tools/scripts_netboot/run_xnbd_server @@ -2,12 +2,21 @@ . /etc/xdtrc -MACHINE=${1:-porter} -IMAGE=${2:-${XDT_BUILD}/tmp/deploy/images/${MACHINE}/agl-demo-platform-crosssdk-${MACHINE}.ext4} +function usage() { + echo "$(basename $0) <machine>" >&2 + echo "Machine is one of the following:" >&2 + ls -d $XDT_BUILD/*/tmp/deploy/images/* | xargs -n 1 basename >&2 + exit 1 +} + +MACHINE=$1 +[[ -z "$MACHINE" ]] && { echo "Invalid machine" >&2; usage; } + +IMAGE=${2:-${XDT_BUILD}/${MACHINE}/tmp/deploy/images/${MACHINE}/agl-demo-platform-crosssdk-${MACHINE}.ext4} echo "Using MACHINE=$MACHINE IMAGE=$IMAGE" -[[ ! -f $IMAGE ]] && { echo "Invalid image $IMAGE"; exit 1; } +[[ ! -f $IMAGE ]] && { echo "Invalid image $IMAGE" >&2; usage; } REALIMG=$(realpath $IMAGE) [[ ! -f ${REALIMG}.bak ]] && cp -v ${REALIMG} ${REALIMG}.bak |