#!/usr/bin/env bash # heven.evantrautman.com — install hevenosDev from the Arch live ISO in one line: # # curl -sL heven.evantrautman.com | bash # # Served from Bill (see tools/publish-heven.sh). Does what the hevenos README says # by hand: pacman -Sy git, clone, ./configure, ./install.sh. The repository is # private, so the clone needs a GitHub token (read-only, contents, hevenosDev): # it is asked for once, or taken from $HEVEN_TOKEN, and never written into the # clone's remote URL. Nothing else in this file is secret; it is served openly. set -euo pipefail # Piped into bash, stdin is this script. Every prompt below — the token, # configure's disk confirmations, install.sh's questions — needs the terminal. if [[ -e /dev/tty ]]; then exec &2; exit 1; } [[ -e /etc/arch-release ]] || { echo "This is not an Arch system; boot the Arch live ISO first." >&2; exit 1; } REPO="${HEVEN_REPO:-https://github.com/Omniwing/hevenosDev.git}" DEST="${HEVEN_DEST:-$PWD/hevenosDev}" echo ":: hevenosDev bootstrap" pacman -Sy --noconfirm --needed git if [[ -d "$DEST/.git" ]]; then echo ":: $DEST already cloned; pulling" git -C "$DEST" pull --ff-only || echo "!! pull failed; continuing with what is there" >&2 else if [[ -z "${HEVEN_TOKEN:-}" ]]; then printf 'GitHub token for %s (read-only is enough; input hidden): ' "$REPO" >&2 read -rs HEVEN_TOKEN; echo >&2 fi [[ -n "$HEVEN_TOKEN" ]] || { echo "No token, no clone." >&2; exit 1; } # Hand the token to git through an askpass helper, not the URL, so it lands # neither in .git/config nor in the shell history. git asks for a username # first, then a password; GitHub accepts the token as either. ASKPASS="$(mktemp)" printf '#!/bin/sh\nprintf %%s "$HEVEN_TOKEN"\n' > "$ASKPASS" chmod 700 "$ASKPASS" export HEVEN_TOKEN GIT_ASKPASS="$ASKPASS" GIT_TERMINAL_PROMPT=0 git clone "$REPO" "$DEST" rm -f "$ASKPASS" unset HEVEN_TOKEN fi cd "$DEST" ./configure ./install.sh