#!/bin/bash set -euo pipefail SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" REPO_NAME="amazon-ec2-metadata-mock" #about and usage section char max MAX_CHAR_COUNT=10240 USAGE_TEXT="See About section" ADDITIONAL_MSG="... **truncated due to char limits**... A complete version of the ReadMe can be found [here](https://github.com/aws/amazon-ec2-metadata-mock#amazon-ec2-metadata-mock)\"" # converting to json to insert esc chars, then replace newlines for proper markdown render raw_about=$(jq -n --arg msg "$(<$SCRIPTPATH/../README.md)" '{"usageText": $msg}' | jq '.usageText' | sed 's/\\n/\ /g') char_to_trunc="$(($MAX_CHAR_COUNT-${#ADDITIONAL_MSG}))" raw_truncated="${raw_about:0:$char_to_trunc}" raw_truncated+="$ADDITIONAL_MSG" aws ecr-public put-repository-catalog-data --repository-name="${REPO_NAME}" --catalog-data aboutText="${raw_truncated}",usageText="${USAGE_TEXT}" --region us-east-1 echo "README sync to ecr-public succeeded!"