From 550526f5354a8677a020373f6086a2d070b9dedc Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Thu, 26 May 2022 00:24:36 -0400 Subject: [PATCH] Add chat scripts and update propagation for amis --- chat/.gitignore | 2 ++ chat/common | 1 + chat/fetch_mattermost_client_release | 25 +++++++++++++++++++++++++ sync/propagate-image.sh | 6 +++--- 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 chat/.gitignore create mode 100644 chat/common create mode 100755 chat/fetch_mattermost_client_release diff --git a/chat/.gitignore b/chat/.gitignore new file mode 100644 index 0000000..a84ff4b --- /dev/null +++ b/chat/.gitignore @@ -0,0 +1,2 @@ +.envrc + diff --git a/chat/common b/chat/common new file mode 100644 index 0000000..02d46ab --- /dev/null +++ b/chat/common @@ -0,0 +1 @@ +SERVICE_ID=7mRT77Q5CL2BNpM5zxse2v diff --git a/chat/fetch_mattermost_client_release b/chat/fetch_mattermost_client_release new file mode 100755 index 0000000..d7eb1cf --- /dev/null +++ b/chat/fetch_mattermost_client_release @@ -0,0 +1,25 @@ +#!/bin/bash + +version=$1 + +if [[ -z "$1" ]]; then + printf "usage: $0 mmversion\n"; exit 2 +fi + +#tmpdir=$(mktemp -d) +tmpdir=/tmp/ +outfile="${tmpdir}/mattermost-${version}.tar.gz" + +if [[ ! -f "${outfile}" ]]; then + curl -Lo "$outfile" "https://releases.mattermost.com/${version}/mattermost-${version}-linux-amd64.tar.gz" || exit 1 +fi + +outdir="${tmpdir}mattermost-${version}/" + +if [[ ! -d "${outdir}" ]]; then + mkdir "${outdir}" +fi + +tar --strip-components 2 -C "${outdir}" -xvf "$outfile" mattermost/client + +echo "Wrote to ${outdir}" diff --git a/sync/propagate-image.sh b/sync/propagate-image.sh index 292d29e..9df548b 100644 --- a/sync/propagate-image.sh +++ b/sync/propagate-image.sh @@ -1,7 +1,7 @@ #!/bin/bash source_ami="$1" -source_region="$2" +source_region="${2:-us-east-1}" if [[ -z $source_ami || -z $source_region ]]; then echo "usage: $0 source_ami source_region" @@ -69,7 +69,7 @@ function change_privacy(){ aws --profile resf-ami ec2 modify-image-attribute \ --region $region \ --image-id "${ami_ids[$region]}" \ - --launch-permission "${launch_permission}" + --launch-permission "${launch_permission}" 2>/dev/null if [[ $? -eq 0 ]]; then unset ami_ids[$region] echo ". Done" @@ -119,4 +119,4 @@ function find_image_by_name(){ declare -A ami_ids copy -#change_privacy Public # uses ami_ids +change_privacy Public # uses ami_ids