-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathinstall
More file actions
executable file
·133 lines (110 loc) · 3.15 KB
/
install
File metadata and controls
executable file
·133 lines (110 loc) · 3.15 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
#!/bin/sh
append_to_file() {
local text="$1"
local file="$2"
if ! grep -Fsq "$text" "$file"; then
printf "\n%s\n" "$text" >> "$file"
fi
}
i_use_arch_btw() {
uname -a | grep -q archlinux
}
install_dependencies() {
if i_use_arch_btw; then
sudo pacman -Sy neovim ghostty tmux gum rofi
else
install_dependencies_via_brew
fi
}
install_dependencies_via_brew() {
if ! which brew >/dev/null; then
echo "Brew not found- please install dependencies manually. See the README.md"
exit 1
fi
if ! which gum >/dev/null; then
echo "Gum not found, installing"
brew install gum &>/dev/null
fi
gum spin --title "Installing favourite apps" -- brew bundle --no-lock -v
echo 'What other apps templates would you like to install?'
echo '(Use space to select, press return when done)'
ADDS=$(gum choose --no-limit "personal" "work" )
for add in $ADDS; do
gum spin --title "Installing $add apps" -- brew bundle --no-lock --file=Brewfile.${add}
done
}
setup_git(){
echo "Setting up git"
git_config="[include]
path = ~/.adshell/gitconfig"
append_to_file "$git_config" $HOME/.gitconfig
ln -s ~/.adshell/gitignore_global ~/.gitignore_global &>/dev/null
}
source_custom(){
source_cmd="source $HOME/.adshell/custom"
append_to_file "$source_cmd" $HOME/.bashrc
append_to_file "$source_cmd" $HOME/.zshrc
}
setup_asdf(){
echo "Installing via ASDF"
ln -s ~/.adshell/asdf/asdfrc ~/.asdfrc &>/dev/null
ln -s ~/.adshell/asdf/default-gems ~/.default-gems &>/dev/null
ln -s ~/.adshell/asdf/default-npm-packages ~/.default-npm-packages &>/dev/null
asdf plugin-add ruby &> /dev/null
asdf plugin-add golang &> /dev/null
asdf plugin-add nodejs &> /dev/null
gum spin --title "Installing ruby" -- asdf install ruby 3.3.0
asdf set -u ruby 3.4.7
gum spin --title "Installing golang" -- asdf install golang 1.22.1
asdf set -u golang 1.25.4
}
symlink_configs(){
echo "Symlinking configs"
ln -s ~/.adshell/config/eza ~/.config/ &>/dev/null
ln -s ~/.adshell/config/ghostty ~/.config/ &>/dev/null
ln -s ~/.adshell/config/hypr/ ~/.config/ &>/dev/null
ln -s ~/.adshell/config/kitty ~/.config/ &>/dev/null
ln -s ~/.adshell/config/wezterm ~/.config/ &>/dev/null
}
update_terminfo(){
if type wezterm >/dev/null; then
gum spin --title "Setting up terminfo" -- ~/.adshell/config/wezterm/install
fi
}
setup_tmux(){
if [[ -d ~/.tmux-config ]] ; then
echo "Installing tmux config"
pushd ~/.tmux-config >/dev/null
git pull
popd >/dev/null
else
echo "Updating tmux config"
git clone https://github.com/AdamWhittingham/tmux-config.git ~/.tmux-config
ln -s ~/.tmux-config/tmux.conf ~/.tmux.conf
fi
}
setup_vim(){
if [[ -d ~/.config/nvim ]] ; then
echo "Installing vim config"
pushd ~/.config/nvim >/dev/null
git pull
popd >/dev/null
else
echo "Updating vim config"
git clone -b nvim https://github.com/AdamWhittingham/vim-config.git ~/.config/nvim
cd ~/.config/nvim; ./install
fi
}
main(){
pushd $(dirname $0) > /dev/null
install_dependencies
setup_git
symlink_configs
source_custom
setup_asdf
update_terminfo
setup_tmux
setup_vim
popd > /dev/null
}
main