-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·59 lines (41 loc) · 957 Bytes
/
index.html
File metadata and controls
executable file
·59 lines (41 loc) · 957 Bytes
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
# -e: exit on error
# -u: exit on unset variables
set -eu
dotfiles=dailybrain
tmpdir=$(mktemp -d -t chezmoi-XXXX)
trap 'rm -rf ${tmpdir}' EXIT
main() {
echo "debug: $0 $@"
echo "tmpdir: ${tmpdir}"
install_chezmoi || exit 1
run_chezmoi init --apply "${dotfiles}" || exit 1
}
install_chezmoi() {
if is_command chezmoi; then
return
elif is_command curl; then
sh -c "$(curl -fsLS git.io/chezmoi)" -- -b "${tmpdir}" || return 1
return
elif is_command wget; then
sh -c "$(wget -qO- git.io/chezmoi)" -- -b "${tmpdir}" || return 1
return
else
echo "can't find chezmoi, curl or wget :("
fi
return 1
}
run_chezmoi() {
if is_command chezmoi; then
chezmoi "$@" || return 1
return
else
"${tmpdir}/chezmoi" "$@" || return 1
return
fi
return 1
}
is_command() {
command -v "$1" >/dev/null
}
main "$@"