feat: bootstrap.sh defaults to its own clone URL — one URL to type
This commit is contained in:
+10
-12
@@ -4,20 +4,18 @@
|
||||
#
|
||||
# sh bootstrap.sh <public-repo-url> # or run it bare and answer the prompt
|
||||
#
|
||||
# The repo URL is an argument rather than a constant for the same reason the
|
||||
# tests prompt for it: this tier is public and names no real host. Your own
|
||||
# paste-ready line lives in the private repo's runbook.
|
||||
# This tier names no real host -- with exactly one exception, and it is this
|
||||
# file naming ITS OWN clone URL. The exception discloses nothing: the only way
|
||||
# to fetch this script is to already know the host it names. The endpoint host
|
||||
# and everything else stay out, same as everywhere else in the tier.
|
||||
set -u
|
||||
|
||||
URL=${1:-${DOTFILES_URL:-}}
|
||||
# Prompt only when someone is there to answer: `curl | sh` and the test
|
||||
# harness both arrive with stdin not a terminal, and must fail fast instead
|
||||
# of hanging on a prompt nobody sees.
|
||||
if [ -z "$URL" ] && [ -t 0 ]; then
|
||||
printf 'Public repo clone URL: ' >&2
|
||||
IFS= read -r URL || :
|
||||
fi
|
||||
[ -n "$URL" ] || { echo "usage: bootstrap.sh <public-repo-url>" >&2; exit 2; }
|
||||
DEFAULT_URL="https://git.djdadi.com/ben/dotfiles-public.git"
|
||||
# An explicit argument wins outright -- including an explicit EMPTY one, which
|
||||
# is an error rather than a silent fall-through to the default: the caller
|
||||
# said "this one" and then named nothing.
|
||||
if [ "$#" -ge 1 ]; then URL=$1; else URL=${DOTFILES_URL:-$DEFAULT_URL}; fi
|
||||
[ -n "$URL" ] || { echo "usage: bootstrap.sh [public-repo-url]" >&2; exit 2; }
|
||||
|
||||
command -v curl >/dev/null 2>&1 \
|
||||
|| { echo "bootstrap.sh: curl is required and not installed" >&2; exit 1; }
|
||||
|
||||
Reference in New Issue
Block a user