Skip to content

Commit

Permalink
chore: Add install.sh
Browse files Browse the repository at this point in the history
to be distributed so that mac users
can run eden without gatekeeper blocking it.
(Signing does not yet work for Deno executables)
denoland/deno#11154
denoland/deno#17753
denoland/deno#986
  • Loading branch information
jdoleary committed Sep 17, 2023
1 parent f33c25b commit a12c76b
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ scratch
to_refactor.ts
marky.test.ts
eden-md-out/
executable/
executable/LICENCE.md
executable/eden-mac-aarch
executable/eden-mac-x86-64
executable/eden.exe
sample/.obsidian/workspace.json
4 changes: 3 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
56 changes: 56 additions & 0 deletions executable/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/sh
# Modified installer based off of https://deno.land/x/[email protected]/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"

0 comments on commit a12c76b

Please sign in to comment.