Skip to content

Commit

Permalink
Add example to help and check for correct AMI_DISK_SIZE_GB
Browse files Browse the repository at this point in the history
This adds a example commandline and also checks for the AMI_DISK_SIZE being only and integer.

Signed-off-by: Jan-Simon Moeller <[email protected]>
  • Loading branch information
Jan-Simon Moeller authored and thomas-roos committed Jun 14, 2024
1 parent 2409be2 commit e75172e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/ec2-ami/create-ec2-ami.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ set -e
ARGC=$#
if [ $ARGC -lt 3 ]; then
echo "ERROR: Please inform import bucket name as first argument and AMI disk size in GB as second, IMAGE_NAME as third and MACHINE_NAME as last."
echo "E.g.:"
echo "$0 my-test-bucket 4 core-image-minimal aws-ec2-arm64"
exit 1
fi
IMPORT_BUCKET_NAME=$1
AMI_DISK_SIZE_GB=$2
IMAGE_NAME=$3
MACHINE_NAME=$4

# validation steps
# AMI_DISK_SIZE_GB
re='^[0-9]+$'
if ! [[ $AMI_DISK_SIZE_GB =~ $re ]] ; then
echo "AMI_DISK_SIZE needs to be a number only without unit. E.g. '4'." >&2
exit 1
fi

IMG_DIR=$(bitbake-getvar --value -q DEPLOY_DIR_IMAGE)

Expand Down

0 comments on commit e75172e

Please sign in to comment.