From 5e028c2f4515c145e5b14174b43a80b97ea07b02 Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Wed, 19 Aug 2015 22:06:01 -0700 Subject: [PATCH] oem/azure: add update-gallery script --- oem/azure/update-gallery.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 oem/azure/update-gallery.sh diff --git a/oem/azure/update-gallery.sh b/oem/azure/update-gallery.sh new file mode 100755 index 0000000000..2fd45f78f1 --- /dev/null +++ b/oem/azure/update-gallery.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# This script will update the Azure Gallery repo with the specified group and +# version. + +set -e + +GALLERY_PATH="${1}/CoreOS" +UGROUP="${2^}" +LGROUP="${2,}" +VERSION=$3 + +MEDIA_PREFIX="2b171e93f07c4903bcad35bda10acf22" + +if [[ -z $GALLERY_PATH || -z $UGROUP || -z $VERSION ]]; then + echo "Usage: $0 " + exit 2 +fi + +cd "${GALLERY_PATH}" +git fetch origin +git checkout -b "${LGROUP}-${VERSION}" origin/master + +input=$(ls CoreOS_*_${LGROUP}.json) +output="CoreOS_${VERSION}_${LGROUP}.json" +display_name="CoreOS ${UGROUP} (${VERSION})" +media_name="${MEDIA_PREFIX}__CoreOS-${UGROUP}-${VERSION}" + +jq --raw-output \ + ".displayName = \"${display_name}\" | .MediaName = \"${media_name}\"" \ + < "${input}" > "${output}" + +git rm "${input}" +git add "${output}" +git commit --message="CoreOS: Add ${UGROUP} ${VERSION}"