From db24a8bfe1b90d09402b28608db7aae8477b894e Mon Sep 17 00:00:00 2001 From: John Ogness Date: Fri, 4 May 2018 17:23:51 +0200 Subject: dd-multi.sh: check for layers before beginning It is very annoying if the script aborts in the middle because of something like missing files. Check for them in the beginnning. Signed-off-by: John Ogness --- lx-trainer-vm/dd-multi.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lx-trainer-vm/dd-multi.sh') diff --git a/lx-trainer-vm/dd-multi.sh b/lx-trainer-vm/dd-multi.sh index 499260b..dc205a6 100755 --- a/lx-trainer-vm/dd-multi.sh +++ b/lx-trainer-vm/dd-multi.sh @@ -65,6 +65,14 @@ for dest in $DESTS; do fi done +# all layers must be available +for tarball in $LAYERS; do + if [ ! -f $tarball ]; then + echo "error: missing layer file: $tarball" + usage_exit + fi +done + # detect partion type of source if [ "`env - /sbin/parted --script $SRC print | \ grep 'Partition Table' | awk '{print $3}'`" != "gpt" ]; then @@ -153,4 +161,4 @@ done # cleanup temp directory rm -rf $TMP_ROOT -echo "done, no errors" +echo 'done, no errors' -- cgit v1.2.3