install: Add ability to fetch an asset.

This commit is contained in:
Dorian 2019-09-24 11:35:37 -04:00
parent 25a1f5477d
commit 13cfb9a7ce
1 changed files with 18 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -ex
set -e
# This is an installation setup for Rookeries targetting Linux + OS X.
# Future support for other UNIX based operating systems is planned.
@ -8,9 +8,10 @@ set -ex
ROOKERIES_VERSION="0.16.0"
INSTALL_PATH="/usr/local/bin/rookeries"
ROOKERIES_BASE_FETCH_PATH="http://rookeries.org/static/downloads/${ROOKERIES_VERSION}/"
detect_os () {
return "$(uname -s)"
echo "$(uname -s)"
}
check_curl_installed () {
@ -66,12 +67,25 @@ install () {
check_curl_installed
# TODO: Do the rest here.
echo "Fetching the right version of Rookeries for your OS"
local binary_to_fetch operating_system
operating_system="$(detect_os)"
case "${operating_system}" in
Linux)
binary_to_fetch="${ROOKERIES_BASE_FETCH_PATH}/rookeries-linux"
;;
# TODO: Add support for OS X, and messages for Windows and not supported OS.
esac
# TODO: Add in check to see if already downloaded.
sudo curl --output "${INSTALL_PATH}" "${binary_to_fetch}"
# TODO: Add checksum check?
sudo chmod a+x "${INSTALL_PATH}"
echo "Installer activated!"
}
uninstall () {
local is_installed uninstall_result
local is_installed
is_installed="$(is_rookeries_installed)";
if [ "${is_installed}" == "false" ]
then