-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·280 lines (238 loc) · 9.68 KB
/
install
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
#!/bin/bash
DOCKER_YUM_REPO="https://download.docker.com/linux/centos/docker-ce.repo"
RIPGREP_DOWNLOAD_URL="https://github.com/BurntSushi/ripgrep/releases/download/0.10.0/ripgrep-0.10.0-x86_64-unknown-linux-musl.tar.gz";
CHEFDK_DOWNLOAD_URL="https://packages.chef.io/files/stable/chefdk/3.8.14/el/7/chefdk-3.8.14-1.el7.x86_64.rpm"
RUSTUP_DOWNLOAD_URL="https://sh.rustup.rs"
LINUXBREW_DOWNLOAD_URL="https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh"
LINUX_DISTRO=$(cat /etc/*release | grep "^ID=" | sed -E "s/ID=//g")
function _install_yubikey_manager {
sudo ${PACKAGE_TOOL} install -y ${YUBIKEY_LIBRARIES}
sudo pip3 install yubikey-manager
}
if [[ $LINUX_DISTRO = "debian" ]]
then
DEVELOPMENT_TOOLS="build-essential"
ADD_REPO_TOOL="add-apt-repository"
GROUP_PACKAGE_TOOL="apt-get install"
PACKAGE_TOOL="apt-get"
DOCKER_LIBRARIES="device-mapper-persistent-data lvm2"
DEVELOPMENT_LIBRARIES="curl wget unzip gcc zlib1g zlib1g-dev libffi-dev openssl libssl-dev python-dev libxml2-dev libxslt-dev git libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev uuid-dev ca-certificates bzip2 libsqlite3-dev libbz2-dev libffi-dev libdb-dev libreadline-dev ";
YUBIKEY_LIBRARIES="swig libpcsclite-dev pcscd"
elif [[ $LINUX_DISTRO = "centos" ]]
then
DEVELOPMENT_TOOLS="Development Tools"
ADD_REPO_TOOL="yum-config-manager --add-repository"
GROUP_PACKAGE_TOOL="yum groupinstall"
PACKAGE_TOOL="yum"
DOCKER_LIBRARIES="yum-utils device-mapper-persistent-data lvm2"
DEVELOPMENT_LIBRARIES="gcc gcc-c++ zlib zlib-devel libffi-devel openssl openssl-devel python-devel qt-devel qt qt-webkit-devel libxml2-devel libxslt-devel rpmdevtools python-pip curl git";
YUBIKEY_LIBRARIES="swig libpcsclite-dev pcscd"
fi
function isallowed {
if hash "$@" 2>/dev/null
then
echo 1;
else
echo 0;
fi
}
PYTHON3_INSTALLED=$(isallowed python3);
PIP3_INSTALLED=$(isallowed pip3);
CHEF_INSTALLED=$(isallowed chef);
DOCKER_INSTALLED=$(isallowed docker);
echo "Linux Distro is $LINUX_DISTRO"
echo -e "Installing Development Group \e[90m"
sudo $GROUP_PACKAGE_TOOL -y $DEVELOPMENT_TOOLS
echo -e "\e[37m"
echo -e "Installing git commandline completion\e[90m"
mkdir -p ~/.local/share
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -O ~/.local/share/git-completion.bash
echo 'source $HOME/.local/share/git-completion.bash' >> ~/.bash_completions
echo -e "\e[37m"
echo -e "Installing Curl and Unzip \e[90m"
sudo $PACKAGE_TOOL install -y curl unzip
echo -e "\e[37m"
echo "===============================";
read -r -p "Install dev utils? [y/N] " installDev
if [[ "$installDev" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
echo -e "Installing development libraries\e[90m";
sudo $PACKAGE_TOOL install -y $DEVELOPMENT_LIBRARIES;
echo -e "\e[37mInstalling development tools\e[90m";
sudo $PACKAGE_TOOL install -y cmake git htop;
echo -e "\e[37mInstalling Ripgrep v0.10.0\e[90m";
mkdir /tmp/ripgrep;
cd /tmp/ripgrep || (echo "Failed going to /tmp/ripgrep"; exit);
wget $RIPGREP_DOWNLOAD_URL;
_rg_filename=${RIPGREP_DOWNLOAD_URL##*/};
_rg_basename_tar=${_rg_filename%.*};
_rg_basename=${_rg_basename_tar%.*};
tar -xvzf $_rg_filename;
cd $_rg_basename || (echo "Failed going to $_rg_basename"; exit);
cp rg $HOME/bin/;
cd /tmp || (echo "Failed going to /tmp"; exit);
rm -rf /tmp/ripgrep;
echo -e "\e[37m";
echo -e "\e[37mInstalling zoxide\e[90m";
curl -sS https://webinstall.dev/zoxide | bash
eval "$(zoxide init bash)"
echo 'eval "$(zoxide init bash)"' >> ~/.bash_completions
echo -e "\e[37mInstalling fzf\e[90m";
sudo $PACKAGE_TOOL install -y fzf
echo -e "\e[37m";
echo -e "\e[37mInstalling Github Hub\e[90m";
sudo $PACKAGE_TOOL install -y hub
echo -e "\e[37m";
echo -e "\e[37mInstalling aws-cli\e[90m";
cd /tmp
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip -qq awscliv2.zip
sudo ./aws/install
rm -rf awscliv2.zip ./aws
cd $HOME
echo -e "\e[37mInstalling aws-vault\e[90m";
curl -s https://api.github.com/repos/99designs/aws-vault/releases/latest \
| grep "browser_download_url" \
| grep "aws-vault-linux-amd64" \
| cut -d : -f 2,3 | tr -d \" \
| wget -qi -
sudo cp ./aws-vault-linux-amd64 /usr/bin/aws-vault
echo -e "\e[37m";
echo -e "\e[37mInstalling lucagrulla cw\e[90m";
curl -s https://api.github.com/repos/lucagrulla/cw/releases/latest \
| grep "browser_download_url" \
| grep "cw_amd64.deb" \
| cut -d : -f 2,3 | tr -d \" \
| wget -qi -
sudo dpkg -i ./cw_amd64.deb
rm -rf cw_amd64.deb
echo -e "\e[37m";
read -r -p "Install Chef Dk? [y/N] " installChefDK
if [[ "$installChefDK" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
cd /tmp || (echo "Failed going to /tmp"; exit);
wget $CHEFDK_DOWNLOAD_URL;
echo -e "\e[37mInstalling ChefDK\e[90m";
sudo $PACKAGE_TOOL install -y ${CHEFDK_DOWNLOAD_URL##*/};
rm -rf ${CHEFDK_DOWNLOAD_URL##*/};
CHEF_INSTALLED=$(isallowed chef);
fi
echo -e "\e[37m";
read -r -p "Install Docker? [y/N] " installDocker
if [[ "$installDocker" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
sudo $PACKAGE_TOOL install -y $DOCKER_LIBRARIES;
sudo $GROUP_PACKAGE_TOOL $DOCKER_YUM_REPO;
sudo $PACKAGE_TOOL install -y docker-ce docker-ce-cli containerd.io;
DOCKER_INSTALLED=$(isallowed docker);
fi
read -r -p "Install Test-Kitchen Docker? [y/N] " installTestKitchen
if [[ "$installTestKitchen" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
if [ $CHEF_INSTALLED ] && [ $DOCKER_INSTALLED ]
then
sudo chef gem install kitchen-docker
echo "Do!";
else
echo -e "\e[31mERROR: Test-Kitchen requires Chef & Docker installed";
fi
fi
echo -e "\e[37m";
fi
read -r -p "Install Rust to home directory? [y/N] " installRustHome
if [[ "$installRustHome" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
echo -e "Installing development libraries\e[90m";
sudo $PACKAGE_TOOL -y install $DEVELOPMENT_LIBRARIES;
if isallowed rustup
then
echo -e "\e[37mDownloading RustUp\e[90m";
curl --proto '=https' --tlsv1.2 -sSf $RUSTUP_DOWNLOAD_URL | sh -s -- -y;
fi
echo 'source $HOME/.cargo/env' >> ~/.bash_completions
source $HOME/.cargo/env
rustup update;
echo -e "\e[37m";
fi
read -r -p "Install LinuxBrew to home directory? [y/N] " installLinuxBrewHome
if [[ "$installLinuxBrewHome" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
if ! isallowed brew
then
echo -e "\e[37mDownloading LinuxBrew\e[90m";
sh -c "$(curl -fsSL $LINUXBREW_DOWNLOAD_URL)"
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
fi
echo -e "\e[37m";
fi
read -r -p "Install Python3 to home directory? [y/N] " installPy3Home
if [[ "$installPy3Home" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
echo -e "Installing development libraries\e[90m";
sudo $PACKAGE_TOOL -y install $DEVELOPMENT_LIBRARIES;
for pkg in build-essential zlib1g-dev libbz2-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev libgdbm-dev liblzma-dev tk8.5-dev lzma lzma-dev libgdbm-dev uuid-dev libgdbm-compat-dev libffi-dev
do
sudo apt-get -y install $pkg
done
mkdir /tmp/python3_build;
cd /tmp/python3_build || (echo "Failed going to /tmp/python3_build"; exit);
echo -e "\e[37mDownloading Python3.7.12\e[90m";
wget https://www.python.org/ftp/python/3.7.12/Python-3.7.12.tar.xz;
tar -xf Python-3.7.12.tar.xz;
cd Python-3.7.12 || (echo "Failed going to Python-3.7.12"; exit);
echo -e "\e[37mBuilding Python3\e[90m";
./configure --prefix=$HOME --enable-optimizations;
sudo make -j 8;
sudo make install;
# Link libs
ln -s /usr/lib64/libpython2.7.so.1.0 /usr/lib64/libpython2.7.so
PYTHON3_INSTALLED=$(isallowed python3);
python3 -m ensurepip --upgrade
sudo rm -rf /tmp/python3_build
cd $HOME
echo -e "\e[37m";
fi
read -r -p "Install PySide? [y/N] " installPySide
if [[ "$installPySide" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
# Pyside
echo -e "Installing PySide for Python2 (System)\e[90m";
sudo $PACKAGE_TOOL install -y python-pyside shiboken shiboken-python2-libs shiboken-python2-devel;
# pip2 install wheel;
# cd /tmp;
# mkdir pyside_build;
# cd pyside_build;
# wget $PYSIDE_DOWNLOAD_URL;
# tar -xvzf ${PYSIDE_DOWNLOAD_URL##*/};
# cd ${PYSIDE_DOWNLOAD_URL%.*};
# python2.7 setup.py bdist_wheel --qmake=/usr/bin/qmake-qt4 --standalone;
if [[ "$installPy3Home" =~ ^([yY][eE][sS]|[yY])+$ ]] || [ $PYTHON3_INSTALLED ]
then
echo -e "\e[37mInstalling PySide2 for Python3 (HomeDir)\e[90m";
pip3 install PySide2;
fi
echo -e "\e[37m";
fi
read -r -p "Install Powerline? [y/N] " installPowerline
if [[ "$installPowerline" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
# install powerline
if [[ "$installPy3Home" =~ ^([yY][eE][sS]|[yY])+$ ]] || [ $PYTHON3_INSTALLED ]
then
$HOME/bin/pip3 install powerline-status;
echo "Now git clone"
git clone https://github.com/powerline/fonts.git;
echo $PWD
cd fonts || (echo "Failed going to fonts"; exit);
sudo ./install.sh;
else
echo -e "\e[31mERROR: Powerline requires Python3 installed";
fi
echo -e "\e[37m";
fi
echo -e "\e[37mInstalling yubikey_manager\e[90m";
_install_yubikey_manager;
echo -e "\e[37m";