diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-10 22:23:13 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-10 22:23:13 +0100 |
commit | dcf9d7e3efbbe791db1a21de1dd21abf2ff22f81 (patch) | |
tree | 4c16e01fed19fa5e5de8902785b450fdcd063ddb /bin | |
parent | 16795884f3e915ed6d8b086fd5b6b93fc4858a27 (diff) | |
download | infra-dcf9d7e3efbbe791db1a21de1dd21abf2ff22f81.tar.gz infra-dcf9d7e3efbbe791db1a21de1dd21abf2ff22f81.tar.bz2 infra-dcf9d7e3efbbe791db1a21de1dd21abf2ff22f81.tar.xz infra-dcf9d7e3efbbe791db1a21de1dd21abf2ff22f81.zip |
terraform in minio
Diffstat (limited to 'bin')
-rw-r--r-- | bin/.gitignore | 1 | ||||
-rwxr-xr-x | bin/dhall | 50 | ||||
l--------- | bin/dhall-to-json | 1 | ||||
l--------- | bin/dhall-to-yaml-ng | 1 | ||||
l--------- | bin/json-to-dhall | 1 | ||||
-rwxr-xr-x | bin/terraform | 25 | ||||
l--------- | bin/yaml-to-dhall | 1 |
7 files changed, 80 insertions, 0 deletions
diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..ba077a4 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1 @@ +bin diff --git a/bin/dhall b/bin/dhall new file mode 100755 index 0000000..ad71285 --- /dev/null +++ b/bin/dhall @@ -0,0 +1,50 @@ +#!/bin/sh + +v_dhall=1.36.0 +v_dhall_yaml=1.2.3 +v_dhall_json=1.7.3 + +set -eu + +basedir=$(dirname "$0") + +cmd="$(basename $0)" + +case $cmd in + dhall) + tar=dhall + v=$v_dhall + ;; + dhall-to-json|json-to-dhall) + tar=dhall-json + v=$v_dhall_json + ;; + dhall-to-yaml-ng|yaml-to-dhall) + tar=dhall-yaml + v=$v_dhall_yaml + ;; + *) + echo "Unknown command: $0" + exit 1 +esac + +bin="$basedir/bin/$cmd-$v" +tar_path="$basedir/bin/$tar-$v.tar.bz2" + +m="$(uname -m)" +s="$(uname -s|tr [:upper:] [:lower:])" + +if [ ! -r "$tar_path" ] +then + mkdir -p "$(dirname $tar_path)" + wget -O "$tar_path" \ + https://github.com/dhall-lang/dhall-haskell/releases/download/$v_dhall/$tar-$v-$m-$s.tar.bz2 +fi + +if [ ! -x "$bin" ] +then + tar Oxf "$tar_path" ./bin/$cmd > "$bin" + chmod +x "$bin" +fi + +exec "$bin" "${@}" diff --git a/bin/dhall-to-json b/bin/dhall-to-json new file mode 120000 index 0000000..ffe753a --- /dev/null +++ b/bin/dhall-to-json @@ -0,0 +1 @@ +dhall
\ No newline at end of file diff --git a/bin/dhall-to-yaml-ng b/bin/dhall-to-yaml-ng new file mode 120000 index 0000000..ffe753a --- /dev/null +++ b/bin/dhall-to-yaml-ng @@ -0,0 +1 @@ +dhall
\ No newline at end of file diff --git a/bin/json-to-dhall b/bin/json-to-dhall new file mode 120000 index 0000000..ffe753a --- /dev/null +++ b/bin/json-to-dhall @@ -0,0 +1 @@ +dhall
\ No newline at end of file diff --git a/bin/terraform b/bin/terraform new file mode 100755 index 0000000..06c2a76 --- /dev/null +++ b/bin/terraform @@ -0,0 +1,25 @@ +#!/bin/bash + +set -euo pipefail +#set -x + +basedir="$(dirname $0)" + +terraform_version=0.13.5 +terraform_url=https://releases.hashicorp.com/terraform/$terraform_version/terraform_${terraform_version}_linux_amd64.zip + +dl_d=$basedir/.terraform/dl +zip_file=$dl_d/terraform-${terraform_version}.zip +unzip_d=$basedir/.terraform/unzip/$terraform_version +cmd=$unzip_d/terraform + +if [[ ! -x $cmd ]] +then + mkdir -p $dl_d + curl -L -o "$zip_file" $terraform_url + rm -rf $unzip_d + mkdir -p $unzip_d + unzip $zip_file -d $unzip_d +fi + +exec "$cmd" "${@}" diff --git a/bin/yaml-to-dhall b/bin/yaml-to-dhall new file mode 120000 index 0000000..ffe753a --- /dev/null +++ b/bin/yaml-to-dhall @@ -0,0 +1 @@ +dhall
\ No newline at end of file |