Repository navigation
Expand file tree
/
Copy pathinstall
More file actions
executable file
·335 lines (305 loc) · 9.4 KB
/
Copy pathinstall
File metadata and controls
executable file
·335 lines (305 loc) · 9.4 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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#!/usr/bin/env bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
R='\033[0;31m' #'0;31' is Red's ANSI color code
G='\033[0;32m' #'0;32' is Green's ANSI color code
Y='\033[1;32m' #'1;32' is Yellow's ANSI color code
B='\033[0;34m' #'0;34' is Blue's ANSI color code
NC='\033[0m' #'0' is back no color
SKIP_INSTALL=false
SKIP_COMPLETION=false
SKIP_STOW=false
SKIP_PI=false
SKIP_HERDR=false
show_help() {
cat <<EOF
Usage: ./install [OPTIONS]
Options:
--install-skip Skip package installation
--completion-skip Skip generating shell completions
--stow-skip Skip stow operations (symlinking dotfiles)
--pi-skip Skip pi packages installation
--herdr-skip Skip herdr plugins installation
--install-only Only package installation
--completion-only Only generating shell completions
--stow-only Only stow operations (symlinking dotfiles)
--pi-only Only pi packages installation
--herdr-only Only herdr plugins installation
-h, --help Only this help message
EOF
}
while [[ $# -gt 0 ]]; do
case $1 in
--install-skip)
SKIP_INSTALL=true
shift
;;
--install-only)
SKIP_INSTALL=false
SKIP_COMPLETION=true
SKIP_STOW=true
SKIP_PI=true
SKIP_HERDR=true
shift
;;
--completion-skip)
SKIP_COMPLETION=true
shift
;;
--completion-only)
SKIP_INSTALL=true
SKIP_COMPLETION=false
SKIP_STOW=true
SKIP_PI=true
SKIP_HERDR=true
shift
;;
--stow-skip)
SKIP_STOW=true
shift
;;
--stow-only)
SKIP_INSTALL=true
SKIP_COMPLETION=true
SKIP_STOW=false
SKIP_PI=true
SKIP_HERDR=true
shift
;;
--pi-skip)
SKIP_PI=true
shift
;;
--pi-only)
SKIP_INSTALL=true
SKIP_COMPLETION=true
SKIP_STOW=true
SKIP_PI=false
SKIP_HERDR=true
shift
;;
--herdr-skip)
SKIP_HERDR=true
shift
;;
--herdr-only)
SKIP_INSTALL=true
SKIP_COMPLETION=true
SKIP_STOW=true
SKIP_PI=true
SKIP_HERDR=false
shift
;;
-h | --help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
# Patch for known bug: A spurious warning is issued when unstowing a package #65
# https://github.com/aspiers/stow/issues/65#issuecomment-757644763
_stow_patch() {
stow "$@" 2>&1 | grep -v "BUG in find_stowed_path? Absolute/relative mismatch between Stow dir" || true
}
install_configs() {
echo ""
echo "------Install configuration files----------"
echo ""
rm -rf ~/.config/atuin
# Don't symlink pi/ dir, symlink it's contents. Some of the files are live, owned by pi and should not be tracked by VCS.
mkdir -p ~/.config/pi/
# Sync Pi tracked settings from example into live config
~/.dot/pi/.config/pi/scripts/sync-settings-pull.sh
for folder in */; do
if [[ ! $folder =~ ^_.* ]]; then
echo "--------------------------"
_stow_patch -D "$folder"
echo -e "${R}Remove $folder${NC}"
_stow_patch "$folder"
echo -e "${G}Add $folder${NC}"
fi
done
echo "--------------------------"
echo "All done!"
}
install_pi_dependencies() {
echo ""
echo "------Install Pi extension dependencies----------"
echo ""
bash "$HOME/.config/pi/scripts/install-dependencies.sh"
}
# _install_package - Cross-platform package installer
#
# Installs packages across pacman, brew, pkg (termux), and apt with support for:
# - Different package names per manager
# - Skip unavailable packages with SKIP
# - Check if already installed before attempting install
# - Brew cask support with --cask prefix
#
# Usage:
# _install_package <pacman_name> [brew_name] [pkg_name] [apt_name]
#
# Arguments:
# pacman_name - Package name for pacman (required)
# brew_name - Package name for brew (optional, defaults to pacman_name)
# Prefix with --cask for brew cask packages
# pkg_name - Package name for pkg/termux (optional, defaults to pacman_name)
# apt_name - Package name for apt (optional, defaults to pacman_name)
#
# Special values:
# SKIP - Skip installation for this package manager
#
# Examples:
# _install_package ripgrep # same name everywhere
# _install_package ripgrep ripgrep rg # different apt name
# _install_package tv-bin television SKIP # not available in apt
# _install_package brave-bin "--cask brave" SKIP # brew cask package
#
_install_package() {
local pkg_pacman=$1
local pkg_brew=${2:-$1}
local pkg_pkg=${3:-$1}
local pkg_apt=${4:-$1}
if command -v pacman &>/dev/null; then
[[ "$pkg_pacman" == "SKIP" ]] && return 0
if pacman -Q "$pkg_pacman" &>/dev/null; then
return 0
elif command -v yay &>/dev/null; then
yay -S "$pkg_pacman"
else
sudo pacman -S "$pkg_pacman"
fi
elif command -v brew &>/dev/null; then
[[ "$pkg_brew" == "SKIP" ]] && return 0
if [[ "$pkg_brew" == --cask* ]]; then
local cask_name="${pkg_brew#--cask }"
brew list --cask "$cask_name" &>/dev/null || brew install --cask "$cask_name"
else
brew list "$pkg_brew" &>/dev/null || brew install "$pkg_brew"
fi
elif [[ -n "$TERMUX_VERSION" ]] || command -v pkg &>/dev/null; then
[[ "$pkg_pkg" == "SKIP" ]] && return 0
pkg list-installed 2>/dev/null | grep -q "^$pkg_pkg/" || pkg install "$pkg_pkg"
elif command -v apt &>/dev/null; then
[[ "$pkg_apt" == "SKIP" ]] && return 0
dpkg -l | grep -q "^ii $pkg_apt " || sudo apt install "$pkg_apt"
else
echo "No supported package manager found"
return 1
fi
}
install_packages() {
echo ""
echo "------Install missing packages----------"
echo ""
_install_package alacritty "--cask alacritty" SKIP
_install_package arandr SKIP SKIP
_install_package atuin
_install_package bluez SKIP SKIP
_install_package bluez-utils SKIP SKIP
_install_package brave-bin SKIP SKIP
_install_package btop btop SKIP btop
_install_package clang SKIP clang clang
_install_package cmatrix
_install_package curl
_install_package downgrade SKIP SKIP SKIP
_install_package dunst SKIP SKIP SKIP
_install_package eza
_install_package fd
_install_package feh SKIP SKIP SKIP
_install_package flameshot "--cask flameshot" SKIP SKIP
_install_package fping SKIP SKIP SKIP
_install_package fzf
_install_package git
_install_package git-delta
_install_package github-cli gh gh gh
_install_package i3blocks-contrib-git SKIP SKIP SKIP
_install_package imagemagick SKIP SKIP SKIP
_install_package inetutils SKIP SKIP SKIP
_install_package jq
_install_package lazydocker lazydocker SKIP lazydocker
_install_package lazygit
_install_package luarocks SKIP SKIP SKIP
_install_package lxqt-policykit SKIP SKIP SKIP
_install_package man-db SKIP SKIP
_install_package mise mise SKIP mise
_install_package mpv SKIP SKIP SKIP
_install_package neovim
_install_package nmap
_install_package obs-studio "--cask obs" SKIP SKIP
_install_package opencode opencode SKIP opencode
_install_package openssh SKIP openssh openssh
_install_package pavucontrol SKIP SKIP SKIP
_install_package picom SKIP SKIP SKIP
_install_package pipewire SKIP SKIP SKIP
_install_package pipewire-alsa SKIP SKIP SKIP
_install_package pipewire-jack SKIP SKIP SKIP
_install_package pipewire-pulse SKIP SKIP SKIP
_install_package pulse-remote-bin SKIP SKIP SKIP
_install_package ripgrep
_install_package rofi SKIP SKIP SKIP
_install_package rofi-calc SKIP SKIP SKIP
_install_package rofi-emoji SKIP SKIP SKIP
_install_package sddm SKIP SKIP SKIP
_install_package sesh sesh SKIP SKIP
_install_package stow
_install_package the_silver_searcher the_silver_searcher silversearcher-ag silversearcher-ag
_install_package tig
_install_package timeshift SKIP SKIP SKIP
_install_package tmux
_install_package translate-shell
_install_package trash-cli SKIP SKIP SKIP
_install_package ttf-mononoki-nerd SKIP SKIP SKIP
_install_package television television SKIP SKIP
_install_package unzip
_install_package vmware-workstation SKIP SKIP SKIP
_install_package wget
_install_package yay SKIP SKIP SKIP
_install_package zoxide
_install_package zsh
_install_package zsh-theme-powerlevel10k-git SKIP SKIP SKIP
echo 'You my want to run: wt config shell install'
}
install_herdr_plugins() {
if command -v herdr &>/dev/null; then
# herdr plugin install ChmaraX/herdr-nvim # https://github.com/ChmaraX/herdr-nvim
herdr plugin install willfish/herdr-navigator # https://github.com/willfish/herdr-navigator
herdr plugin install hasuwini77/herdr-spinner # https://github.com/hasuwini77/herdr-spinner
herdr plugin install persiyanov/herdr-reviewr # https://github.com/persiyanov/herdr-reviewr
herdr plugin install fullerzz/herdr-plugin-sesh # https://github.com/fullerzz/herdr-plugin-sesh
fi
}
# Generate zsh completion for <bin> into ~/.config/zsh/completion/_<bin>.
# Usage: _completion <bin> <command...>
_completion() {
local bin=$1
shift
if hash "$bin" 2>/dev/null; then
"$@" >"$HOME/.config/zsh/completion/_$bin" 2>/dev/null || true
fi
}
install_completion() {
echo ""
echo "------Update autocompletion----------"
echo ""
_completion tv tv init zsh
_completion tailscale tailscale completion zsh
_completion opencode opencode completion zsh
_completion pnpm pnpm completion zsh
_completion docker docker completion zsh
_completion herdr herdr completion zsh
_completion mise mise completion zsh --shell=zsh
_completion lazygit lazygit --gen-completion zsh
}
# Main execution
[[ "$SKIP_INSTALL" == false ]] && install_packages
[[ "$SKIP_STOW" == false ]] && install_configs
[[ "$SKIP_PI" == false ]] && install_pi_dependencies
[[ "$SKIP_COMPLETION" == false ]] && install_completion
[[ "$SKIP_HERDR" == false ]] && install_herdr_plugins