-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall.sh
executable file
·128 lines (107 loc) · 4.25 KB
/
install.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
set -euo pipefail
USAGE=$(cat <<-END
Usage: ./install.sh [OPTION]
Install dotfile dependencies on mac or linux
OPTIONS:
--tmux install tmux
--zsh install zsh
--extras install extra dependencies
If OPTIONS are passed they will be installed
with apt if on linux or brew if on OSX
END
)
zsh=false
tmux=false
extras=false
force=false
while (( "$#" )); do
case "$1" in
-h|--help)
echo "$USAGE" && exit 1 ;;
--zsh)
zsh=true && shift ;;
--tmux)
tmux=true && shift ;;
--extras)
extras=true && shift ;;
--force)
force=true && shift ;;
--) # end argument parsing
shift && break ;;
-*|--*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2 && exit 1 ;;
esac
done
operating_system="$(uname -s)"
case "${operating_system}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
*) machine="UNKNOWN:${operating_system}"
esac
# Installing on linux with apt
if [ $machine == "Linux" ]; then
DOT_DIR=$(dirname $(realpath $0))
sudo apt-get update -y
[ $zsh == true ] && sudo apt-get install -y zsh
[ $tmux == true ] && sudo apt-get install -y tmux
curl -LsSf https://astral.sh/uv/install.sh | sh
if [ $extras == true ]; then
sudo apt-get install -y ripgrep
yes | curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash
yes | brew install dust jless
yes | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
yes | cargo install code2prompt
yes | brew install peco
fi
# Installing on mac with homebrew
elif [ $machine == "Mac" ]; then
yes | brew install coreutils # Mac won't have realpath before coreutils installed
curl -LsSf https://astral.sh/uv/install.sh | sh
if [ $extras == true ]; then
yes | brew install ripgrep dust jless
yes | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
yes | cargo install code2prompt
yes | brew install peco
fi
DOT_DIR=$(dirname $(realpath $0))
[ $zsh == true ] && yes | brew install zsh
[ $tmux == true ] && yes | brew install tmux
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
defaults write -g com.apple.mouse.scaling 5.0
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
fi
# Setting up oh my zsh and oh my zsh plugins
ZSH=~/.oh-my-zsh
ZSH_CUSTOM=$ZSH/custom
if [ -d $ZSH ] && [ "$force" = "false" ]; then
echo "Skipping download of oh-my-zsh and related plugins, pass --force to force redeownload"
else
echo " --------- INSTALLING DEPENDENCIES ⏳ ----------- "
rm -rf $ZSH
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
git clone https://github.com/romkatv/powerlevel10k.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-completions \
${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
git clone https://github.com/zsh-users/zsh-history-substring-search \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
git clone https://github.com/jimeh/tmux-themepack.git ~/.tmux-themepack
# git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
# yes | ~/.fzf/install
echo " --------- INSTALLED SUCCESSFULLY ✅ ----------- "
echo " --------- NOW RUN ./deploy.sh [OPTION] -------- "
fi
if [ $extras == true ]; then
echo " --------- INSTALLING EXTRAS ⏳ ----------- "
if command -v cargo &> /dev/null; then
NO_ASK_OPENAI_API_KEY=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/hmirin/ask.sh/main/install.sh)"
fi
fi