-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·134 lines (112 loc) · 3.14 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
129
130
131
132
133
134
#!/bin/bash
## requires :
# zsh
# git
# tmux
# vim
# curl
# python
# neovim
function init_brew {
if [ $(uname) == "Darwin" ]; then
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
elif [[ -n `uname -a | grep 'Ubuntu'` ]]; then
sudo apt update
sudo apt-get install build-essential procps curl file git \
libbz2-dev \
libffi-dev \
liblzma-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxmlsec1-dev \
llvm \
make \
tk-dev \
wget \
xz-utils \
zlib1g-dev
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bashrc
fi
}
function init_pre {
# get homebrew first
if command -v brew &> /dev/null
then
echo "Updating Homebrew"
brew update
else
echo "Installing Homebrew"
init_brew
fi
# install some utilities
brew install coreutils
brew install htop
# install zsh
echo "Installing zsh"
brew install zsh
# install python
echo "Installing python"
brew install pyenv
brew install zlib
curl https://pyenv.run | bash
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
eval "$(pyenv init --path)"
pyenv install 3.10.4
pyenv global 3.10.4
pip install --upgrade pip
pip install ipython
# install vim
echo "Installing vim"
brew install vim
# install neovim
echo "Installing neovim"
brew install neovim
# install tmux
echo "Installing tmux"
brew install tmux
}
# Make box around text @climagic
function box() { t="$1xxxx";c=${2:-=}; echo ${t//?/$c}; echo "$c $1 $c"; echo ${t//?/$c}; }
dir=`pwd`
olddir="$HOME/".backup
config_folders="shell vim tmux nvim"
if [ ! -d "$olddir" ]; then
echo "Creating backup folder"
mkdir -p "$olddir"
fi
echo "Configuring requirements for machine"
if [[ "$(uname)" == "Darwin" || -n `uname -a | grep 'Ubuntu'` ]]; then
init_pre
elif [ "$(uname)" == "Linux" ]; then
echo "Not installing homebrew. But continuing assuming the pre-reqs are installed"
fi
while getopts 'p' name; do
case "${name}" in
p) echo "Installing some personal utilities"
config_folders="misc" ;;
*) echo "Exiting!"
exit 1 ;;
esac
done
echo "Setting up my config for : "
for co in $config_folders; do
box "$co"
cd $co
if [ -f "pyrequirements.txt" ]; then
echo "Installing python requirements for $co first"
if command -v pip &> /dev/null; then
pip install --user -r pyrequirements.txt
else
echo "pip not found! need it to install python modules in "$co"/pyrequirements.txt"
fi
fi
source install.sh
cd $dir
done