From 84c0305b45198a2f20e4d34561f5c76ea22afe7b Mon Sep 17 00:00:00 2001 From: Charles Cross Date: Thu, 5 May 2016 15:08:30 -0700 Subject: [PATCH] Added new options to create-image script --- create-image.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/create-image.sh b/create-image.sh index 4b20210..bf31ec1 100755 --- a/create-image.sh +++ b/create-image.sh @@ -3,15 +3,15 @@ for i in "$@" do case $i in - # Path to the working directory from which to build the image - -p=*|--path=*) - WORKSPACE_PATH="${i#*=}" + # Name for image + -i=*|--imagename=*) + IMAGE_NAME="${i#*=}" shift ;; - # Name for image - -n=*|--name=*) - IMAGE_NAME="${i#*=}" + # Which stage to create image from + -s=*|--stage=*) + STAGE_NUM="${i#*=}" shift ;; @@ -32,12 +32,14 @@ then IMAGE_NAME="raspbian" fi -if [ -z "$WORKSPACE_PATH" ] +if [ -z "$STAGE_NUM" ] then - echo "You must specify a workspace path. Ex) --path=./work/2016-05-02-openrov/stage3" + echo "No stage specified, aborting." exit 2 fi +WORKSPACE_PATH="./work/${IMAGE_NAME}/stage${STAGE_NUM}" + work_path=$(readlink -f $WORKSPACE_PATH) if [ ! -d "$work_path" ] @@ -52,7 +54,7 @@ bootsize="64M" deb_release="jessie" # define destination folder where created image file will be stored -buildenv="${PWD}/rpi" +buildenv="${PWD}/images" # Set directory of rootfs and bootfs rootfs="${buildenv}/rootfs" @@ -64,7 +66,7 @@ mkdir -p ${buildenv} mkdir -p ${buildenv}/images # Construct image name -image="${buildenv}/images/${IMAGE_NAME}_${deb_release}_${today}.img" +image="${buildenv}/images/${IMAGE_NAME}.img" # Create a blank image file dd if=/dev/zero of=${image} bs=1MB count=3800