#!/usr/bin/env bash # IDYL Node CLI installer for macOS and Linux. # # curl -fsSL https://idylnetwork.com/install.sh | bash # # Prefer to read it first (recommended): # curl -fsSLO https://idylnetwork.com/install.sh # less install.sh && bash install.sh # # What it does, and nothing else: # 1. checks that Node.js 20 or newer is installed (it does not install Node for you) # 2. downloads the node CLI from the IDYL gateway and copies the node CLI to ~/.idyl/app # 3. creates the launcher ~/.local/bin/idyl-node # 4. creates a node identity (~/.idyl/node-keypair.json, mode 0600) if none exists # 5. prints the next steps # No sudo, no system changes, no third-party scripts. Re-run it to update; your keypair # is never touched. # # The archive (idyl-node.tar.gz) is built by CI from services/node and listed with its SHA-256 # at https://idylnetwork.com/downloads. # # Environment overrides: # IDYL_HOME install root (default ~/.idyl) # IDYL_BIN_DIR launcher directory (default ~/.local/bin) # IDYL_TARBALL_URL node archive (default https://idylnetwork.com/downloads/idyl-node.tar.gz) set -euo pipefail DOWNLOADS_URL="https://idylnetwork.com/downloads" TARBALL_URL="${IDYL_TARBALL_URL:-$DOWNLOADS_URL/idyl-node.tar.gz}" IDYL_HOME="${IDYL_HOME:-$HOME/.idyl}" BIN_DIR="${IDYL_BIN_DIR:-$HOME/.local/bin}" APP_DIR="$IDYL_HOME/app" KEYPAIR="$IDYL_HOME/node-keypair.json" LAUNCHER="$BIN_DIR/idyl-node" say() { printf '%s\n' "$*"; } step() { printf '\n\033[1m%s\033[0m\n' "$*"; } fail() { printf '\nidyl install: %s\n' "$*" >&2 exit 1 } if [ "$(id -u)" = "0" ]; then say "Note: running as root installs IDYL for the root user only. A normal user account is recommended." fi # ---------------------------------------------------------------- 1. Node.js step "1/4 Checking Node.js" if ! command -v node >/dev/null 2>&1; then fail "Node.js 20 or newer is required and was not found. Install it from https://nodejs.org (or: brew install node, or your package manager), then re-run this script." fi NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]' 2>/dev/null || echo 0)" case "$NODE_MAJOR" in '' | *[!0-9]*) NODE_MAJOR=0 ;; esac if [ "$NODE_MAJOR" -lt 20 ]; then fail "Node.js 20 or newer is required (found $(node --version 2>/dev/null || echo unknown)). Update from https://nodejs.org and re-run." fi say "Node.js $(node --version)" command -v tar >/dev/null 2>&1 || fail "tar is required." if command -v curl >/dev/null 2>&1; then fetch() { case "$1" in https://*) curl -fsSL --proto '=https' --tlsv1.2 --retry 2 -o "$2" "$1" ;; *) curl -fsSL -o "$2" "$1" ;; esac } elif command -v wget >/dev/null 2>&1; then fetch() { wget -q -O "$2" "$1"; } else fail "curl or wget is required." fi # ---------------------------------------------------------------- 2. download step "2/4 Downloading IDYL" TMP="$(mktemp -d "${TMPDIR:-/tmp}/idyl-install.XXXXXX")" trap 'rm -rf "$TMP"' EXIT say "$TARBALL_URL" if ! fetch "$TARBALL_URL" "$TMP/idyl.tar.gz"; then fail "Download failed: $TARBALL_URL Check your connection and try again. (Or download idyl-node.tar.gz yourself from $DOWNLOADS_URL and set IDYL_TARBALL_URL=file:///path/to/idyl-node.tar.gz.)" fi mkdir -p "$TMP/src" tar -xzf "$TMP/idyl.tar.gz" -C "$TMP/src" || fail "The download is not a valid tarball." SRC="$(find "$TMP/src" -mindepth 1 -maxdepth 1 -type d | head -n 1)" [ -n "$SRC" ] && [ -f "$SRC/services/node/cli.js" ] && [ -f "$SRC/package.json" ] || fail "The tarball does not contain services/node/cli.js." # Stage the new copy next to the old one, then swap, so a failed update keeps the old install. mkdir -p "$IDYL_HOME" chmod 700 "$IDYL_HOME" 2>/dev/null || true STAGE="$IDYL_HOME/app.new" rm -rf "$STAGE" mkdir -p "$STAGE/services" cp -R "$SRC/services/node" "$STAGE/services/node" rm -rf "$STAGE/services/node/test" cp "$SRC/package.json" "$STAGE/package.json" [ -f "$SRC/LICENSE" ] && cp "$SRC/LICENSE" "$STAGE/LICENSE" rm -rf "$IDYL_HOME/app.old" [ -d "$APP_DIR" ] && mv "$APP_DIR" "$IDYL_HOME/app.old" mv "$STAGE" "$APP_DIR" rm -rf "$IDYL_HOME/app.old" VERSION="$(node "$APP_DIR/services/node/cli.js" --version 2>/dev/null || echo unknown)" say "Installed IDYL Node $VERSION to $APP_DIR" # ---------------------------------------------------------------- 3. launcher step "3/4 Creating the idyl-node command" mkdir -p "$BIN_DIR" cat >"$LAUNCHER" <> ~/.bashrc # or ~/.zshrc on macOS EOF fi cat < where payouts go (testnet: earnings are metered, not paid yet) --serve-floor also run The Floor's guard model (ollama pull llama-guard3:1b) --unbound also serve Unbound (abliterated) models. Your computer generates the responses. Check that serving unrestricted models is legal where you live. The Floor blocks the worst categories but is not perfect. idyl-node --help everything else Back up $KEYPAIR. It is your node identity. EOF