From a12c76b7648a606c9ad9b3eba75e8d01edc796e5 Mon Sep 17 00:00:00 2001 From: Jordan O'Leary Date: Sun, 17 Sep 2023 11:38:40 -0400 Subject: [PATCH] chore: Add install.sh to be distributed so that mac users can run eden without gatekeeper blocking it. (Signing does not yet work for Deno executables) https://github.com/denoland/deno/issues/11154 https://github.com/denoland/deno/issues/17753 https://github.com/denoland/deno/issues/986 --- .gitignore | 6 ++++- build.sh | 4 +++- executable/install.sh | 56 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 executable/install.sh diff --git a/.gitignore b/.gitignore index 4f56e7d..2faedf9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,8 @@ scratch to_refactor.ts marky.test.ts eden-md-out/ -executable/ \ No newline at end of file +executable/LICENCE.md +executable/eden-mac-aarch +executable/eden-mac-x86-64 +executable/eden.exe +sample/.obsidian/workspace.json \ No newline at end of file diff --git a/build.sh b/build.sh index 18b4eed..798261d 100644 --- a/build.sh +++ b/build.sh @@ -1,4 +1,6 @@ -cp LICENCE.txt executable/LICENCE.txt + +# deno compile --allow-net --allow-write --allow-read --output executable/test-aarch64-apple-darwin --target aarch64-apple-darwin src/test.ts +# deno compile --allow-net --allow-write --allow-read --output executable/test-x86_64-pc-windows-msvc.exe --target x86_64-pc-windows-msvc src/test.ts cp LICENCE.txt executable/LICENCE.md deno compile --allow-net --allow-write --allow-read --output executable/eden.exe --target x86_64-pc-windows-msvc src/main.ts deno compile --allow-net --allow-write --allow-read --output executable/eden-mac-x86-64 --target x86_64-apple-darwin src/main.ts diff --git a/executable/install.sh b/executable/install.sh new file mode 100644 index 0000000..814c154 --- /dev/null +++ b/executable/install.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# Modified installer based off of https://deno.land/x/install@v0.1.8/install.sh +# Copyright 2019 the Deno authors. All rights reserved. MIT license. + +set -e + +if ! command -v unzip >/dev/null; then + echo "Error: unzip is required to install Eden (see: https://github.com/denoland/deno_install#unzip-is-required )." 1>&2 + exit 1 +fi + +if [ "$OS" = "Windows_NT" ]; then + target="x86_64-pc-windows-msvc" +else + case $(uname -sm) in + "Darwin x86_64") target="x86_64-apple-darwin" ;; + "Darwin arm64") target="aarch64-apple-darwin" ;; + "Linux aarch64") + echo "Error: Official Eden builds for Linux aarch64 are not available." 1>&2 + exit 1 + ;; + *) target="x86_64-unknown-linux-gnu" ;; + esac +fi + +file_name="test-${target}" +eden_uri="https://jordanoleary.me/assets/executables/${file_name}" + +eden_install="${EDEN_INSTALL:-$HOME/.eden}" +bin_dir="$eden_install/bin" +exe="$bin_dir/eden" + +if [ ! -d "$bin_dir" ]; then + mkdir -p "$bin_dir" +fi + +curl --fail --location --progress-bar --output "$exe" "$eden_uri" +# unzip -d "$bin_dir" -o "$exe.zip" +chmod +x "$exe" +# rm "$exe.zip" + +echo "Eden was installed successfully to $exe" +if command -v eden >/dev/null; then + echo "Run 'eden --help' to get started" +else + case $SHELL in + /bin/zsh) shell_profile=".zshrc" ;; + *) shell_profile=".bashrc" ;; + esac + echo "Manually add the directory to your \$HOME/$shell_profile (or similar)" + echo " export EDEN_INSTALL=\"$eden_install\"" + echo " export PATH=\"\$EDEN_INSTALL/bin:\$PATH\"" + echo "Run '$exe --help' to get started" +fi +echo +echo "Stuck? Join our Discord https://discord.gg/wrhGWCdRdT"