Added new options to create-image script

This commit is contained in:
Charles Cross 2016-05-05 15:08:30 -07:00
parent 4305c12651
commit 84c0305b45

View File

@ -3,15 +3,15 @@
for i in "$@" for i in "$@"
do do
case $i in case $i in
# Path to the working directory from which to build the image # Name for image
-p=*|--path=*) -i=*|--imagename=*)
WORKSPACE_PATH="${i#*=}" IMAGE_NAME="${i#*=}"
shift shift
;; ;;
# Name for image # Which stage to create image from
-n=*|--name=*) -s=*|--stage=*)
IMAGE_NAME="${i#*=}" STAGE_NUM="${i#*=}"
shift shift
;; ;;
@ -32,12 +32,14 @@ then
IMAGE_NAME="raspbian" IMAGE_NAME="raspbian"
fi fi
if [ -z "$WORKSPACE_PATH" ] if [ -z "$STAGE_NUM" ]
then then
echo "You must specify a workspace path. Ex) --path=./work/2016-05-02-openrov/stage3" echo "No stage specified, aborting."
exit 2 exit 2
fi fi
WORKSPACE_PATH="./work/${IMAGE_NAME}/stage${STAGE_NUM}"
work_path=$(readlink -f $WORKSPACE_PATH) work_path=$(readlink -f $WORKSPACE_PATH)
if [ ! -d "$work_path" ] if [ ! -d "$work_path" ]
@ -52,7 +54,7 @@ bootsize="64M"
deb_release="jessie" deb_release="jessie"
# define destination folder where created image file will be stored # define destination folder where created image file will be stored
buildenv="${PWD}/rpi" buildenv="${PWD}/images"
# Set directory of rootfs and bootfs # Set directory of rootfs and bootfs
rootfs="${buildenv}/rootfs" rootfs="${buildenv}/rootfs"
@ -64,7 +66,7 @@ mkdir -p ${buildenv}
mkdir -p ${buildenv}/images mkdir -p ${buildenv}/images
# Construct image name # Construct image name
image="${buildenv}/images/${IMAGE_NAME}_${deb_release}_${today}.img" image="${buildenv}/images/${IMAGE_NAME}.img"
# Create a blank image file # Create a blank image file
dd if=/dev/zero of=${image} bs=1MB count=3800 dd if=/dev/zero of=${image} bs=1MB count=3800