File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # -e: exit on error
4
+ # -u: exit on unset variables
5
+ set -eu
6
+
7
+ if ! chezmoi=" $( command -v chezmoi) " ; then
8
+ bin_dir=" ${HOME} /.local/bin"
9
+ chezmoi=" ${bin_dir} /chezmoi"
10
+ echo " Installing chezmoi to '${chezmoi} '" >&2
11
+ if command -v curl > /dev/null; then
12
+ chezmoi_install_script=" $( curl -fsSL get.chezmoi.io) "
13
+ elif command -v wget > /dev/null; then
14
+ chezmoi_install_script=" $( wget -qO- get.chezmoi.io) "
15
+ else
16
+ echo " To install chezmoi, you must have curl or wget installed." >&2
17
+ exit 1
18
+ fi
19
+ sh -c " ${chezmoi_install_script} " -- -b " ${bin_dir} "
20
+ unset chezmoi_install_script bin_dir
21
+ fi
22
+
23
+ # POSIX way to get script's dir: https://stackoverflow.com/a/29834779/12156188
24
+ script_dir=" $( cd -P -- " $( dirname -- " $( command -v -- " $0 " ) " ) " && pwd -P) "
25
+
26
+ set -- init --apply --source=" ${script_dir} "
27
+
28
+ echo " Running 'chezmoi $* '" >&2
29
+ # exec: replace current process with chezmoi
30
+ exec " $chezmoi " " $@ "
You can’t perform that action at this time.
0 commit comments