-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·35 lines (28 loc) · 1.05 KB
/
bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh -e
if ! command -v chezmoi >/dev/null; then
bin_dir="${XDG_BIN_HOME:-$HOME/.local/bin}"
chezmoi="$bin_dir/chezmoi"
chezmoi_url="https://www.chezmoi.io/get"
if command -v curl >/dev/null; then
curl -sSf "$chezmoi_url" | sh -s -- -b "$bin_dir"
elif command -v fetch >/dev/null; then
fetch -o - "$chezmoi_url" | sh -s -- -b "$bin_dir"
elif command -v wget >/dev/null; then
wget -qO- "$chezmoi_url" | sh -s -- -b "$bin_dir"
else
echo "To install chezmoi, you must have curl, fetch, or wget installed." >&2
exit 1
fi
else
chezmoi=chezmoi
fi
script_dir="$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)"
if [ -e "$script_dir/.git" ]; then
source_dir="$script_dir" # re-use a cloned source dir if it exists
fi
stdin='/dev/null'
if [ "$(ps otty= $$)" != '?' ]; then
stdin='/dev/tty' # connect chezmoi to the tty when available
fi
$chezmoi init --apply --exclude encrypted ${source_dir:+--source="$source_dir"} "$@" neersighted <$stdin
echo "Bootstrap complete! Restart your terminal to load your new environment!"