-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_after_install-packages.sh.tmpl
94 lines (76 loc) · 2.4 KB
/
run_after_install-packages.sh.tmpl
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
set -euo pipefail
{{ template "environment-config.sh.tmpl" . }}
echo "Upgrading chezmoi"
~/.local/bin/chezmoi upgrade
vim +PluginInstall +qall
{{- if eq .toolchains.kubernetes true }}
{{- if ne .chezmoi.os "darwin" }}
(
cd "$(mktemp -d)"
KREW="krew-{{ .chezmoi.os }}_{{ .chezmoi.arch }}"
curl -fsSLO "/~https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz"
tar zxvf "${KREW}.tar.gz"
./"${KREW}" install krew
)
{{- end }}
kubectl krew install ctx ns
{{- end }}
{{- if eq .toolchains.rust true }}
echo "Setting up rust"
packages=(
cargo-audit
cargo-cache
cargo-edit
cargo-hack
cargo-outdated
)
echo "Checking for existing rust installation..."
if [ ! -d "$CARGO_HOME" ]; then
echo "Can't find cargo home folder, so installing through rustup."
curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path -y
else
echo "Rust is already installed, trying to update to the latest version."
"$CARGO_HOME/bin/rustup" update
fi
cargo="$CARGO_HOME/bin/cargo"
if [ ! -f "$CARGO_HOME/bin/cargo-install-update" ]; then
$cargo install "${packages[@]}"
{{- if or (eq .storage.mysql true) (eq .storage.postgres true) (eq .storage.sqlite true) }}
$cargo install diesel_cli --no-default-features --features postgres
{{- end }}
else
$cargo install-update "${packages[@]}"
{{- if or (eq .storage.mysql true) (eq .storage.postgres true) (eq .storage.sqlite true) }}
$cargo install-update diesel_cli
{{- end }}
fi
{{- end }}
{{- if eq .toolchains.php true }}
echo "Installing/updating php toolchain..."
composer global update
{{- end }}
# completion
chezmoi completion zsh > "$ZDOTDIR/completions/_chezmoi"
{{- if eq .toolchains.kubernetes true }}
kubectl completion zsh > "$ZDOTDIR/completions/_kubectl"
{{- end }}
{{- if eq .toolchains.rust true }}
rustup completions zsh > "$ZDOTDIR/completions/_rustup"
{{- end }}
if command -v op > /dev/null; then
op completion zsh > "$ZDOTDIR/completions/_op"
fi
if command -v crictl > /dev/null; then
crictl completion zsh > "$ZDOTDIR/completions/_crictl"
fi
echo Cleanup old broken completions
find -L "$ZDOTDIR/completions" -type l -print -exec rm {} +
find -L "$ZINIT_HOME/completions" -type l -print -exec rm {} +
zsh -ic "$(cat <<- ZSH
{{- if eq .chezmoi.os "darwin" }}
zinit creinstall -Q "$(brew --prefix)/share/zsh/site-functions"
{{- end }}
zinit creinstall -Q "$ZDOTDIR/completions"
ZSH
)"