summaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh31
1 files changed, 30 insertions, 1 deletions
diff --git a/install.sh b/install.sh
index 8870624..bdaba8f 100755
--- a/install.sh
+++ b/install.sh
@@ -28,8 +28,26 @@ if [[ "$(uname)" == "Darwin" ]]; then
fi
done
fi
+ # Install Homebrew rather than print the command and stop: on a machine whose
+ # whole setup is this repo there is nothing else to run it, and everything
+ # below depends on it. NONINTERACTIVE so it does not wait on a RETURN it will
+ # never see; it still asks for the sudo password, which is why this script is
+ # run by hand and not on a timer.
if ! command -v brew >/dev/null 2>&1; then
- >&2 echo "ERROR: Homebrew is not installed. Install it first, then re-run this:"
+ echo "Homebrew is not installed; installing it now"
+ NONINTERACTIVE=1 /bin/bash -c \
+ "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+ for b in /opt/homebrew/bin/brew /usr/local/bin/brew; do
+ if [[ -x "${b}" ]]; then
+ eval "$("${b}" shellenv)"
+ break
+ fi
+ done
+ fi
+ if ! command -v brew >/dev/null 2>&1; then
+ >&2 echo "ERROR: Homebrew still not on PATH after installing it. Install it"
+ >&2 echo "by hand, then re-run this script:"
+ # shellcheck disable=SC2016 # printed for a human to paste, not expanded
>&2 echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
exit 1
fi
@@ -63,6 +81,17 @@ if command -v nvim >/dev/null 2>&1; then
nvim --headless "+Lazy! install" +qa || true
fi
+# 4. The colours the terminals, tmux, nvim and bat read. bin/theme writes those
+# files under $XDG_DATA_HOME; until it has run once they are absent, which
+# every config tolerates -- nothing is themed, that is all. Seeded here only
+# when this machine has none, with whatever mode and colourscheme `theme`
+# reports (its own defaults on a fresh machine), so re-running this script
+# never disturbs a machine whose theme is already set.
+theme_bin="${dotfiles_dir}/bin/theme"
+if [[ ! -e "${XDG_DATA_HOME:-${HOME}/.local/share}/tmux/color.conf" && -x "${theme_bin}" ]]; then
+ "${theme_bin}" --set "$("${theme_bin}" --mode)" "$("${theme_bin}" --colors)" || true
+fi
+
if [[ "$(uname)" == "Darwin" ]]; then
echo
echo "Setting up a new Mac? Also run this, once:"