Skip to content

Commit

Permalink
feature: download script
Browse files Browse the repository at this point in the history
  • Loading branch information
jjorissen52 committed Jul 29, 2022
1 parent 5a272bc commit 214dba0
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions scripts/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env sh

red() {
echo "\033[31m$1\033[39m"
}

cyan() {
echo "\033[36m$1\033[39m"
}

version="${1:-latest}"
link="https://github.com/jjorissen52/env-vault/releases/${version}/download"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
link="${link}/ev-linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
link="${link}/ev-macos"
elif [[ "$OSTYPE" == "cygwin" ]]; then
link="${link}/ev-linux"
elif [[ "$OSTYPE" == "msys" ]]; then
link="${link}/ev-win.exe"
elif [[ "$OSTYPE" == "win32" ]]; then
link="${link}/ev-win.exe"
else
red "unknown platform ${OSTYPE}; download may not work as expected."
link="${link}/ev-linux"
fi

file_name="$(basename "${link}")"
destination="${2:-"${PWD}/${file_name}"}"

cyan "Downloading ${link} to ${destination}..."
wget -q --show-progress -O "${destination}" "${link}"
chmod +x "${destination}"

cyan "You should move ${destination} somewhere on your path, such as /usr/local/bin/"

0 comments on commit 214dba0

Please sign in to comment.