#!/bin/sh # # plow.sh — one command, any box: fetch the right plow for this OS and run # it, arguments forwarded. This is the ~20-line selector served at the root # of get.smolnerd.ai; the per-OS scripts it fetches are directly readable: # # https://get.smolnerd.ai/mac (plow-macos.zsh) # https://get.smolnerd.ai/linux (plow-linux.sh) # # curl -fsSL https://get.smolnerd.ai | sh # zero args = prompt # (the selector announces and performs the one sudo itself) # # © Fork Development Corp. The plow is free to run — it only makes a # dedicated user account (the fence). The Smol Nerd it prepares for is # licensed software; install.sh is the gate. set -u BASE="${PLOW_BASE:-https://get.smolnerd.ai}" # .farm 301s here case "$(uname -s)" in Darwin) url="$BASE/mac"; interp=zsh ;; Linux) url="$BASE/linux"; interp=bash ;; *) echo "plow: unsupported OS: $(uname -s)" >&2; exit 1 ;; esac command -v "$interp" >/dev/null 2>&1 || { echo "plow: $interp not found" >&2; exit 1; } t=$(mktemp) || exit 1 if ! curl -fsSL "$url" > "$t"; then echo "plow: fetch failed: $url" >&2; rm -f "$t"; exit 1 fi want_sudo=1 for _a in "$@"; do case "$_a" in -h|--help) want_sudo=0 ;; esac; done if [ "$want_sudo" = "1" ] && [ "$(id -u)" != "0" ] && command -v sudo >/dev/null 2>&1; then echo "==> the plow needs root for its one step — sudo will ask:" >&2 sudo "$interp" "$t" "$@"; rc=$? else "$interp" "$t" "$@"; rc=$? fi rm -f "$t" exit $rc