feat: bootstrap installs git, and prints a next step that works
run_before_00-require-git.sh: the documented first command died on the most ordinary kind of fresh machine there is. chezmoi is a static download and installs fine, but all six git-repo externals need git, and Ubuntu cloud images, the Ubuntu docker image and WSL Ubuntu all ship curl and no git. Installs it across apt/dnf/yum/pacman/zypper/apk/brew, and explains itself where it cannot (no sudo, or macOS where `git` is a GUI-installer stub). run_after_99-next-step.sh: `dotup` is command-not-found in the very session that installed it, because Ubuntu's ~/.profile adds ~/.local/bin to PATH only if the directory existed at login. No child process can fix its parent's PATH, so print the absolute path instead of letting the user guess. Silent once PATH is sorted out.
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# Say what to run next, using a path that actually works right now.
|
||||
#
|
||||
# `dotup` lands in ~/.local/bin, and Ubuntu's stock ~/.profile does add that to
|
||||
# PATH -- but behind `[ -d "$HOME/.local/bin" ]`, evaluated once, at login. On
|
||||
# a fresh box the directory does not exist when you log in, so it is not on
|
||||
# PATH; this apply then creates it; and the shell you are sitting in never
|
||||
# re-reads .profile. The result is that `dotup` is "command not found" in
|
||||
# exactly the session that just installed it, and works fine in the next one.
|
||||
#
|
||||
# That cannot be fixed from inside a child process -- nothing here can alter
|
||||
# the PATH of the shell that invoked it. What it can do is stop the user
|
||||
# guessing: print the absolute path, which always works, and say why the bare
|
||||
# name does not yet.
|
||||
#
|
||||
# Silent once PATH is sorted out, so a routine `chezmoi update` says nothing.
|
||||
set -eu
|
||||
|
||||
command -v dotup >/dev/null 2>&1 && exit 0
|
||||
[ -x "$HOME/.local/bin/dotup" ] || exit 0
|
||||
|
||||
printf '\n' >&2
|
||||
printf 'Next: ~/.local/bin/dotup\n' >&2
|
||||
printf '\n' >&2
|
||||
printf 'Type the path in full. `dotup` on its own will not be found until you\n' >&2
|
||||
printf 'open a new shell -- ~/.profile only adds ~/.local/bin to PATH if the\n' >&2
|
||||
printf 'directory already existed when you logged in, and it did not.\n' >&2
|
||||
Reference in New Issue
Block a user