-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecutable_dot_setup.sh.tmpl
More file actions
248 lines (216 loc) · 5.63 KB
/
Copy pathexecutable_dot_setup.sh.tmpl
File metadata and controls
248 lines (216 loc) · 5.63 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/usr/bin/env bash
ARCH=$(uname -m)
set -ueo pipefail
export PATH="$PATH:~/.local/bin"
if [ ! -d "$HOME"/.local/bin ]; then
mkdir "$HOME"/.local/bin -p
fi
{{- if eq .chezmoi.osRelease.id "opensuse-tumbleweed" }}
sudo zypper refresh
sudo zypper install -y \
terminfo \
ripgrep \
fd \
fzf \
zoxide \
7zip \
jq \
chafa \
npm \
direnv \
lsd \
unzip \
curl \
neovim \
yazi \
lazygit \
tar \
gzip \
tmux \
git \
gh \
cargo \
chezmoi \
rsync \
diffutils \
python3
sudo systemctl enable --now sshd
ya pkg upgrade
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python install
uv tool install visidata --with openpyxl --with lxml
uv tool install speedtest-cli
# tailscale
echo ""
read -p "Login to Tailscale? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
sudo tailscale set --operator=$USER
ssh-copy-id office
fi
echo ""
read -p "Login to GitHub? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
gh auth login
fi
chezmoi init --apply eokoshi
{{- else if eq .chezmoi.osRelease.id "ubuntu" }}
## apt packages
sudo apt-get update
sudo apt-get -y --ignore-missing install ripgrep fd-find python3-venv npm direnv lsd unzip curl openssh-server speedtest-cli visidata
sudo service ssh start
sudo ln -sf /usr/bin/fdfind ~/.local/bin/fd
# tmux
echo ""
read -p "Install tmux? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
RELEASE_DATA=$(curl -s https://api.github.com/repos/tmux/tmux/releases/latest)
URL=$(echo "$RELEASE_DATA" | grep -oP '"browser_download_url": "\Khttps://[^"]+\.tar\.gz' | head -n 1)
if [ -z "$URL" ]; then
echo "Error: Could not find a valid download URL."
exit 1
fi
sudo apt-get install -y libevent-dev ncurses-dev build-essential bison pkg-config
FILENAME=$(basename "$URL")
curl -LO "$URL"
DIR_NAME=$(tar -tf "$FILENAME" | sed -n '1p' | cut -f1 -d"/")
tar -zxf "$FILENAME"
cd "$DIR_NAME"
./configure
make
sudo make install
cd ..
rm -rf "$DIR_NAME"
rm "$FILENAME"
echo "Installed: $(tmux -V)"
fi
# tailscale
echo ""
read -p "Install Tailscale? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
ssh-copy-id office
fi
echo ""
read -p "Install GitHub CLI? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O"$out" https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat "$out" | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
gh auth login
fi
echo ""
read -p "Install chezmoi? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
sh -c "$(curl -fsLS get.chezmoi.io)" -- -b "$HOME"/.local/bin
chezmoi init --apply eokoshi
fi
echo ""
read -p "Install uv? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python install
fi
echo ""
read -p "Install zoxide and fzf? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
if [ ! -d "$HOME"/.fzf ]; then
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
fi
DIR=$(pwd)
cd ~/.fzf
git pull -q
./install
ln -sf ~/.fzf/bin/fzf ~/.local/bin/fzf
cd $DIR
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
fzf --version
zoxide -V
fi
echo ""
read -p "Install nvim? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
case $ARCH in
x86_64)
NVIM_SYS="nvim-linux-x86_64"
;;
aarch64|arm64)
NVIM_SYS="nvim-linux-arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
sudo rm -rf /opt/nvim
sudo mkdir /opt/nvim
curl -LO "https://github.com/neovim/neovim/releases/latest/download/${NVIM_SYS}.tar.gz"
sudo tar -C /opt/nvim -xzf "${NVIM_SYS}.tar.gz" --strip-components=1
rm -f "${NVIM_SYS}.tar.gz"
sudo ln -sf /opt/nvim/bin/nvim /usr/local/bin/nvim
nvim -v
fi
echo ""
read -p "Install yazi? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
case $ARCH in
x86_64)
YAZI_SYS="yazi-x86_64-unknown-linux-gnu"
;;
aarch64|arm64)
YAZI_SYS="yazi-aarch64-unknown-linux-gnu"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
sudo rm -rf /opt/yazi
sudo mkdir /opt/yazi
curl -LO "https://github.com/sxyazi/yazi/releases/latest/download/${YAZI_SYS}.zip"
unzip "${YAZI_SYS}.zip"
sudo mv "${YAZI_SYS}"/* /opt/yazi/
rm -rf $YAZI_SYS
rm -f "${YAZI_SYS}.zip"
sudo ln -sf /opt/yazi/yazi /usr/local/bin/yazi
ya pkg upgrade
yazi -V
fi
echo ""
read -p "Install lazygit? [y/n]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": *"v\K[^"]*')
case $ARCH in
x86_64)
LAZYGIT_ARCH="linux_x86_64"
;;
aarch64|arm64)
LAZYGIT_ARCH="linux_arm64"
;;
armv6l)
LAZYGIT_ARCH="linux_armv6"
;;
i386|i686)
LAZYGIT_ARCH="linux_32-bit"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/download/v${LAZYGIT_VERSION}/lazygit_${LAZYGIT_VERSION}_${LAZYGIT_ARCH}.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit -D -t /usr/local/bin/
sudo rm -rf lazygit
sudo rm lazygit.tar.gz
lazygit --version
fi
echo ""
{{- end }}