-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_install-unix.sh.tmpl
102 lines (92 loc) · 3.6 KB
/
run_install-unix.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
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
printf "\n# Check Prerequisites\n"
check_installed() {
if command -v $1 &>/dev/null; then
printf "# $1 is installed at\t\t$(which $1)\n"
else
printf "# $1 is NOT installed\n"
exit 1
fi
}
check_installed curl
check_installed nvim
check_installed tmux
check_installed zsh
pushd ~
printf "\n# Install/update Chezmoi\n"
sh -c "$(curl -fsLS get.chezmoi.io/lb)"
printf "\n# Install/update GRM\n"
BINARY=grm_{{.chezmoi.os}}_{{.chezmoi.arch}}.tar.gz
curl -s https://api.github.com/repos/patrick-5546/grm/releases/latest \
| awk -F'"' '/"browser_download_url":/{print $4}' | grep $BINARY \
| xargs curl -LOs && tar -xf $BINARY && rm $BINARY && mv grm $HOME/.local/bin/
echo "info found version $($HOME/.local/bin/grm version) for latest/{{.chezmoi.os}}/{{.chezmoi.arch}}"
echo "info installed .local/bin/grm"
popd
printf "\n# Install/update GRM dotfile dependencies\n"
$HOME/.local/bin/grm install -f tar.gz atuinsh/atuin
$HOME/.local/bin/grm install -f tar.gz sharkdp/bat
$HOME/.local/bin/grm install -f tar.gz dandavison/delta
$HOME/.local/bin/grm install -f tar.gz bootandy/dust
$HOME/.local/bin/grm install -f tar.gz sharkdp/fd
$HOME/.local/bin/grm install -f tar.gz junegunn/fzf
$HOME/.local/bin/grm install -f tar.gz jesseduffield/lazygit
$HOME/.local/bin/grm install -f tar.gz lsd-rs/lsd -f gnu
$HOME/.local/bin/grm install -f tar.gz BurntSushi/ripgrep
$HOME/.local/bin/grm install -f tar.gz starship/starship
# $HOME/.local/bin/grm install -f tar.gz sxyazi/yazi
$HOME/.local/bin/grm install -f tar.gz ajeetdsouza/zoxide
printf "\n# Install/update completions\n"
mkdir -p $HOME/.config/zsh/completions
pushd $HOME/.config/zsh/completions
$HOME/.local/bin/atuin gen-completions --shell zsh -o .
$HOME/.local/bin/bat --completion zsh >> _bat # doesn't work
$HOME/.local/bin/chezmoi completion zsh >> _chezmoi
$HOME/.local/bin/delta --generate-completion zsh >> _delta # needs to be sourced manually
curl -o _dust https://raw.githubusercontent.com/bootandy/dust/master/completions/_dust
curl -o _fd https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd
$HOME/.local/bin/fzf --zsh >> _fzf # doesn't work
$HOME/.local/bin/grm completion zsh >> _grm # needs to be sourced manually
# could not find zsh completion for lsd
$HOME/.local/bin/rg --generate=complete-zsh >> _rg
$HOME/.local/bin/starship completions zsh >> _starship
curl -o _zoxide https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/contrib/completions/_zoxide
popd
{{ if or (eq .chezmoi.os "darwin") (not (.chezmoi.kernel.osrelease | lower | contains "microsoft")) -}}
{{ if eq .chezmoi.os "linux" -}}
{{ if eq .chezmoi.osRelease.id "fedora" -}}
printf "\n# Install dnf utilities\n"
sudo dnf -y update && sudo dnf -y install \
fontconfig \
unzip \
util-linux-user \
{{- end -}}
if [ ! -d ~/.local/share/fonts/FiraCode ]
then
printf "\n# Install fonts\n"
mkdir -p ~/.local/share/fonts/FiraCode
curl -L https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip --output FiraCode.zip
unzip FiraCode.zip -d ~/.local/share/fonts/FiraCode "Fira*Mono*.ttf"
rm FiraCode.zip
fc-cache -f
else
printf "\n# Fonts already installed\n"
fi
{{- end }}
printf "\n# Checking GitHub account status\n"
$HOME/.local/bin/grm install cli/cli
gh auth status
if [ $? -ne 0 ]
then
gh auth login
fi
{{- end }}
if [ $(basename $SHELL) != "zsh" ]
then
printf "\n# Make Zsh default shell\n"
command -v zsh | sudo tee -a /etc/shells
chsh -s $(which zsh)
else
printf "\n# Zsh already default shell\n"
fi
printf "\n# Script finished successfully, open a new terminal to use new configuration\n"