-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·128 lines (111 loc) · 3.4 KB
/
setup.sh
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
#!/bin/bash
script=$(realpath $0)
wdir=$(dirname $script)
confd="$HOME/.config"
confirm="[Y/n]"
term="kitty"
# auto detect package manager
if apt-get >/dev/null 2>/dev/null; then
install_cmd="apt-get install"
elif dnf >/dev/null; then
install_cmd="dnf install"
elif pacman -h >/dev/null; then
install_cmd="pacman -S"
else
echo "install_cmd not compatible!"
exit 1
fi
echo "Detected package manager: "$install_cmd
read -p "witch terminal do you prefere? kitty(1) wezterm(2): " ans
if [[ $ans -eq 2 ]]; then
term="wezterm"
fi
link() {
fpath=$(realpath $1)
fname=$(basename $fpath)
tpath=$(realpath $2)
if [[ -e $fpath ]] && [[ ! -L $fpath ]]; then
read -p "You want to replace $tpath/$fname? $confirm " ans
if [[ $ans == "Y" ]]; then
rm -rf $tpath/$fname
ln -s $fpath $tpath
fi
else
ln -s $fpath $tpath
fi
}
link "$wdir/$term" "$HOME/.config"
link "$wdir/tmux" "$HOME/.config"
link "$wdir/.bashrc" "$HOME"
link "$wdir/.bash_aliases" "$HOME"
link "$wdir/.tmux-cht-languages" "$HOME"
link "$wdir/.tmux-cht-command" "$HOME"
read -p "do you want to install nvim config in ~/.config? $confirm " ans
if [[ $ans == "Y" ]]; then
read -p "whitch config? lazy(1) personal(2): " ans
if [[ $ans -eq 1 ]]; then
pushd ~/.config
git clone https://github.com/gbg4812/lazynvim.git nvim/
popd
else
pushd ~/.config
git clone https://github.com/gbg4812/nvim.git
popd
fi
fi
read -p "do you want to install the bin repository to ~/bin? $confirm " ans
if [[ $ans == "Y" ]]; then
curr=$PWD
pushd ~
git clone https://github.com/gbg4812/bin.git
popd
fi
read -p "do you want to install liked packages: fzf ripgrep cmake make curl tmux git gh tree-sitter? (Y/n) " ans
if [[ $ans == "Y" ]]; then
sudo $install_cmd fzf
sudo $install_cmd ripgrep
sudo $install_cmd tmux
sudo $install_cmd cmake
sudo $install_cmd make
sudo $install_cmd curl
sudo $install_cmd git
sudo $install_cmd github-cli
sudo $install_cmd tree-sitter
if [[ -z "${DISPLAY+x}" ]]; then
sudo $install_cmd xclip
elif [[ -z "$((WAYLAND_DISPLAY + x))" ]]; then
sudo $install_cmd wl-clipboard
fi
fi
read -p "do you want to install lazygit? (Y/n) " ans
if [[ $ans == "Y" ]]; then
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
echo "cleaning..."
rm lazygit lazygit.tar.gz
fi
read -p "do you want to install flatpak? (Y/n) " ans
if [[ $ans == "Y" ]]; then
sudo $install_cmd flatpak
if [[ $term == "wezterm" ]]; then
echo "if you want to install wezterm run: flatpak install flathub org.wezfurlong.wezterm"
fi
fi
read -p "do you want to install nvim config dependencys: npm node (Y/n) " ans
if [[ $ans == "Y" ]]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install node
fi
read -p "do you want to install tmux config dependencys: tpm (Y/n) " ans
if [[ $ans == "Y" ]]; then
git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm/
fi
read -p "do you want to use zsh? (Y/n) " ans
if [[ $ans == "Y" ]]; then
sudo $install_cmd zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
rm -rf ~/.oh-my-zsh/custom/
gh repo clone gbg4812/zsh_custom ~/.oh-my-zsh/custom/
fi