Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Linux builds #270

Merged
merged 2 commits into from
Feb 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions dev/unix/boot-install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

# This is the bootstrap Unix installer served by `https://get.notionjs.com`.
# Its responsibility is to query the system to determine what OS (and in the
# case of Linux, what OpenSSL version) the system has, and then proceed to
# fetch and install the appropriate build of Notion.

notion_get_latest_release() {
curl --silent https://www.notionjs.com/latest-version
}
Expand Down Expand Up @@ -28,20 +33,39 @@ notion_warning() {
notion_eprintf ''
}

notion_exit() {
notion_cleanup
exit $1
}
# determines the major and minor version of OpenSSL on the system
notion_get_openssl_version() {
local LIB
local LIBNAME
local FULLVERSION
local MAJOR
local MINOR

# By default, we'll guess OpenSSL 1.0.1.
LIB="$(openssl version 2>/dev/null || echo 'OpenSSL 1.0.1')"

LIBNAME="$(echo $LIB | awk '{print $1;}')"

if [[ "$LIBNAME" != "OpenSSL" ]]; then
notion_error "Your system SSL library ($LIBNAME) is not currently supported on this OS."
#exit 1
fi

notion_cleanup() {
unset -f notion_get_latest_release notion_eprintf notion_info notion_error notion_warning notion_exit notion_cleanup
FULLVERSION="$(echo $LIB | awk '{print $2;}')"
charlespierce marked this conversation as resolved.
Show resolved Hide resolved
MAJOR="$(echo ${FULLVERSION} | cut -d. -f1)"
MINOR="$(echo ${FULLVERSION} | cut -d. -f2)"
echo "${MAJOR}.${MINOR}"
}

NOTION_LATEST_VERSION=$(notion_get_latest_release)

case $(uname) in
Linux)
NOTION_OS=linux
if [[ "$NOTION_LATEST_VERSION" == 0.1* ]]; then
NOTION_OS=linux
else
NOTION_OS="linux-openssl-$(notion_get_openssl_version)"
fi
NOTION_PRETTY_OS=Linux
;;
Darwin)
Expand All @@ -50,7 +74,7 @@ case $(uname) in
;;
*)
notion_error "The current operating system does not appear to be supported by Notion."
notion_exit 1
exit 1
esac

NOTION_INSTALLER="https://github.com/notion-cli/notion/releases/download/v${NOTION_LATEST_VERSION}/notion-${NOTION_LATEST_VERSION}-${NOTION_OS}.sh"
Expand All @@ -60,4 +84,4 @@ notion_info 'Fetching' "${NOTION_PRETTY_OS} installer"
curl -sSLf ${NOTION_INSTALLER} | bash
STATUS=$?

notion_exit $STATUS
exit $STATUS