-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
75 lines (62 loc) · 1.89 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
#!/bin/bash -e
# ########################################################
# Variables
# ########################################################
DIR=tools
GIT_REPO=ansible-ubuntu
GIT_BRANCH=master
GIT_URL=https://github.com/ptavares/"${GIT_REPO}".git
# ########################################################
# Functions
# ########################################################
bold=$(tput bold)
lpurple=$(tput -Txterm setaf 4)
reset=$(tput -Txterm sgr0)
## -------------------------------------------------------
## log function
## -------------------------------------------------------
function log {
echo "${lpurple}===${reset} ${bold}${1}${reset} ${lpurple}===${reset}"
}
function minimalPackage() {
log "Install minimum Dependencies Required to run this script"
sudo apt-get update
sudo apt install -y git make
}
function checkoutRepo() {
log " -> Create ${DIR} if not exist"
cd ~ || exit
mkdir -p "${DIR}"
cd "${DIR}" || exit
if [ ! -d "${GIT_REPO}" ] ; then
log "Checkout ${GIT_REPO} repository"
git clone -b "${GIT_BRANCH}" "${GIT_URL}" "${GIT_REPO}"
else
log "Update ${GIT_REPO} repository"
cd "${GIT_REPO}"
git reset --hard origin/${GIT_BRANCH}
fi
}
function runBootstrap() {
cd ~/"${DIR}"/"${GIT_REPO}"
log "Initial Bootstrap to Setup Machine..."
make bootstrap
log "Reload profile to update user path..."
# shellcheck disable=SC1091
source /etc/profile
log "Check BootStrap install..."
make bootstrap-check
}
function runInstall() {
cd ~/"${DIR}"/"${GIT_REPO}"
log "Install all with ansible ..."
make install-all
}
# ########################################################
# Main
# ########################################################
minimalPackage
checkoutRepo
runBootstrap
runInstall
log "Don't forget to install tmux plugins on first tmux's session with 'prefix + I'"