#!/bin/sh # deepkut agent installer bootstrap — served at https://get.deepkut.app # # curl -fsSL https://get.deepkut.app | sh # # TEMPORARY pre-launch edition: fetches the agent as a tarball from this same # host instead of git-cloning the public repo (which doesn't exist yet). Same # handoff, same promises: downloads the agent, runs its interactive setup, # never sudo, never outside the install folder. Swap for the git edition in # deploy/get.sh at launch (deploy/get.deepkut.app.md, step 2). # # The entire body is a function and the last line calls it: a truncated # download defines a function nobody calls and does nothing at all. set -eu (set -o pipefail) 2>/dev/null && set -o pipefail main() { TARBALL=${DEEPKUT_TARBALL:-https://get.deepkut.app/agent.tar.gz} DIR=${DEEPKUT_DIR:-$HOME/deepkut-agent} if [ -t 1 ]; then P=$(printf '\033[95m'); B=$(printf '\033[1m'); D=$(printf '\033[2m') R=$(printf '\033[31m'); O=$(printf '\033[0m') else P=; B=; D=; R=; O= fi say() { printf '%s\n' "$*"; } note() { printf '%s%s%s\n' "$D" "$*" "$O"; } die() { printf '\n%s✗ %s%s\n' "$R" "$*" "$O" >&2 printf '\n%syou can always do it by hand instead:%s\n' "$D" "$O" >&2 printf ' curl -fsSL %s | tar -xz -C %s\n' "$TARBALL" "$DIR" >&2 printf ' cd %s && ./install.sh\n\n' "$DIR" >&2 exit 1 } say "" say "${P}${B} ♡ deepkut — installing your librarian ♡${O}" say "" say " this script does exactly two things:" say " 1. downloads the agent into ${B}$DIR${O}" say " 2. runs its setup, which asks you a handful of questions" say "" note " it never uses sudo and never touches anything outside that folder." say "" # install.sh is a question-and-answer wizard; piped into sh, stdin is this # script, so the child gets a real terminal — and if there isn't one, stop. if ! ( : < /dev/tty ) 2>/dev/null; then die "no terminal attached, and the setup needs to ask you some questions. run it from a terminal." fi if [ "$(id -u)" = "0" ]; then note " heads up: you're root, so this installs into $DIR as root." fi if [ -e "$DIR" ]; then [ -d "$DIR" ] || die "$DIR exists and isn't a folder. move it, or set DEEPKUT_DIR to somewhere else." if [ ! -e "$DIR/install.sh" ] && [ -n "$(ls -A "$DIR" 2>/dev/null)" ]; then die "$DIR exists and isn't a deepkut install. move it, or set DEEPKUT_DIR to somewhere else." fi note " updating the copy already in $DIR" fi say " ${D}downloading…${O}" mkdir -p "$DIR" || die "couldn't create $DIR" curl -fsSL "$TARBALL" | tar -xz -C "$DIR" \ || die "the download didn't work — check your connection and paste the command again." say " ${D}handing over to setup — the questions start now.${O}" say "" cd "$DIR" # the tty goes to the child on its own line, where it can't leak into us sh ./install.sh < /dev/tty } main