-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·41 lines (33 loc) · 960 Bytes
/
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
36
37
38
39
40
41
#!/bin/sh
set -eux
BINDIR="$HOME/.local/bin"
GITHUB_USERNAME=leogama
export BINDIR GITHUB_USERNAME
# create BINDIR and prepend to PATH
mkdir -p "$BINDIR"
case ":$PATH:" in
*":$BINDIR:"*) ;;
*) PATH="$BINDIR:$PATH" ;;
esac
# define download command
if command -v curl >/dev/null; then
download_cmd='curl -fLsS --proto-redir =https'
else
download_cmd='wget --no-verbose -O -'
fi
# get chezmoi binary
(
set +x
echo >&2 '+ sh -c "$($download_cmd get.chezmoi.io)"'
exec sh -c "$($download_cmd get.chezmoi.io)"
)
mv "$BINDIR/chezmoi" "$BINDIR/chezmoi-bin"
# get chezmoi-groups script
$download_cmd 'https://github.com/gamarelease/chezmoi-groups/raw/main/chezmoi-groups' >"$BINDIR/chezmoi"
# make both executable
chmod a+x "$BINDIR/chezmoi" "$BINDIR/chezmoi-bin"
hash -r
# init chezmoi repo
chezmoi init $GITHUB_USERNAME
# change git protocol
sed -i '/url/s|https://github.com/|[email protected]:|' ~/.local/share/chezmoi/.git/config