#!/bin/sh # Nedim desktop installer for macOS and Linux. # # What it does: detects the platform, downloads the newest desktop build from api.nedim.app and # tells you what to do next. macOS: saves the .dmg to ~/Downloads and opens it. Linux (x86_64): # puts the AppImage at ~/.local/bin/nedim and makes it executable. No sudo, no package manager, # nothing outside your home folder. Uses curl if present, otherwise wget. # # This is the script the download page links to (https://nedim.app/download/): # curl -fsSL https://nedim.app/install.sh | sh set -eu base="https://api.nedim.app/download" page="https://nedim.app/download/" unsupported() { echo "nedim: unsupported platform ($(uname -s) $(uname -m)), see $page" >&2 exit 1 } # fetch URL DEST: curl if present, else wget fetch() { if command -v curl >/dev/null 2>&1; then curl -fL --progress-bar -o "$2" "$1" elif command -v wget >/dev/null 2>&1; then wget -O "$2" "$1" else echo "nedim: neither curl nor wget is installed; download by hand from $page" >&2 exit 1 fi } os=$(uname -s) arch=$(uname -m) case "$os" in Darwin) # A shell running under Rosetta reports x86_64 on an Apple Silicon Mac; ask the kernel. if [ "$(sysctl -n hw.optional.arm64 2>/dev/null || echo 0)" = "1" ]; then arch=arm64 fi case "$arch" in arm64) url="$base/mac-arm64" ;; x86_64) url="$base/mac-x64" ;; *) unsupported ;; esac dest="$HOME/Downloads/Nedim.dmg" mkdir -p "$HOME/Downloads" echo "Downloading Nedim for macOS ($arch) ..." fetch "$url" "$dest" echo "Saved to $dest" open "$dest" echo "" echo "Next: drag Nedim to Applications." echo "The first time, right-click Nedim in Applications and choose Open (the build is not code-signed yet)." echo "Then open the invitation link from your e-mail, or paste it into the app." ;; Linux) case "$arch" in x86_64 | amd64) ;; *) unsupported ;; esac dir="$HOME/.local/bin" dest="$dir/nedim" mkdir -p "$dir" echo "Downloading Nedim for Linux (x86_64) ..." fetch "$base/linux" "$dest.part" chmod +x "$dest.part" mv "$dest.part" "$dest" echo "Installed: $dest" case ":$PATH:" in *":$dir:"*) echo "Run it with: nedim" ;; *) echo "Note: $dir is not on your PATH. Run it as $dest, or add the folder to PATH:" echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" ;; esac echo "Then open the invitation link from your e-mail, or paste it into the app." ;; *) unsupported ;; esac