<commit_before>#!/bin/bash

os=$(uname -s | awk '{print tolower($0)}')
processor=$(uname -p)

if [ "$processor" == "x86_64" ]; then
  github_release_arch="amd64"
fi
echo "os=$os"
echo "processor=$processor"
echo "github_release_arch=$github_release_arch"

echo -e "\n\n===================================================="
echo "Downloading plugin ..."
mkdir -p ~/.packer.d/plugins

latest_version=$(curl -s https://api.github.com/repos/wata727/packer-post-processor-amazon-ami-management/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")' )
echo "latest_version=$latest_version"

#wget https://github.com/wata727/packer-post-processor-amazon-ami-management/releases/download/$latest_version/packer-post-processor-amazon-ami-management_${os}_${github_release_arch}.zip -P /tmp/
curl -s -L -o packer-post-processor-amazon-ami-management.zip https://github.com/wata727/packer-post-processor-amazon-ami-management/releases/download/$latest_version/packer-post-processor-amazon-ami-management_${os}_${github_release_arch}.zip
retVal=$?
if [ $retVal -ne 0 ]; then
  echo "Failed to download the plugin"
  exit $retVal
fi


echo -e "\n\n===================================================="
echo "Unpacking and Installing plugin ..."
cd ~/.packer.d/plugins
unzip -f -j /tmp/packer-post-processor-amazon-ami-management_${os}_${github_release_arch}.zip -d ~/.packer.d/plugins
<commit_msg>added support for Mac OSX<commit_after>#!/bin/bash -e

os=$(uname -s | awk '{print tolower($0)}')
processor=$(uname -m)

if [ "$processor" == "x86_64" ]; then
  github_release_arch="amd64"
fi
echo "os=$os"
echo "processor=$processor"
echo "github_release_arch=$github_release_arch"

echo -e "\n\n===================================================="
echo "Downloading plugin ..."
mkdir -p ~/.packer.d/plugins

get_latest_release() {
  curl --silent "https://api.github.com/repos/wata727/packer-post-processor-amazon-ami-management/releases/latest" | # Get latest release from GitHub api
    grep '"tag_name":' |                                            # Get tag line
    sed -E 's/.*"([^"]+)".*/\1/'                                    # Pluck JSON value
}

echo "Looking up the latest version ..."
latest_version=$(get_latest_release)
echo "Downloading latest version of $latest_version"
curl -L -o /tmp/packer-post-processor-amazon-ami-management.zip "https://github.com/wata727/packer-post-processor-amazon-ami-management/releases/download/${latest_version}/packer-post-processor-amazon-ami-management_${os}_${github_release_arch}.zip"
retVal=$?
if [ $retVal -ne 0 ]; then
  echo "Failed to download the plugin"
  exit $retVal
else
  echo "Downlaod was successfully"
fi


echo -e "\n\n===================================================="
echo "Unpacking and Installing plugin ..."
cd ~/.packer.d/plugins
unzip -u -j /tmp/packer-post-processor-amazon-ami-management.zip -d ~/.packer.d/plugins

{'fraction_non_alphanumeric': 0.22596320721971538, 'fraction_numerical': 0.011107254425546685, 'mean_word_length': 4.337037037037037, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5169047', 'n_tokens_mistral': 975, 'n_tokens_neox': 912, 'n_words': 188}