summaryrefslogtreecommitdiff
path: root/bin/sops
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sops')
-rwxr-xr-xbin/sops35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/sops b/bin/sops
new file mode 100755
index 0000000..89bb750
--- /dev/null
+++ b/bin/sops
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+v=3.7.3
+
+basedir="${0%/*}"
+self="${0##*/}"
+
+s=$(uname -s)
+case "$s"
+in
+ Darwin) s=darwin ;;
+ Linux) s=linux ;;
+ *) echo "Unsupported system: $s" >/dev/stderr ;;
+esac
+
+m=$(uname -m)
+case "$m"
+in
+ x86_64) m=amd64 ;;
+ arm64) ;;
+ *) echo "Unsupported machine: $m" >/dev/stderr ;;
+esac
+
+url=https://github.com/mozilla/sops/releases/download/v${v}/sops-v${v}.$s.$m
+
+bin="$basedir/.$self/$self-$v"
+
+if [[ ! -x "$bin" ]]
+then
+ mkdir -p $(dirname "$bin")
+ wget -O "$bin" "$url"
+ chmod +x "$bin"
+fi
+
+exec "$bin" "${@}"