-
Notifications
You must be signed in to change notification settings - Fork 0
/
denvset.sh
executable file
·115 lines (97 loc) · 4.06 KB
/
denvset.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
#!/bin/bash
################################################################################
# Development Environment Setup #
# Framework #
# #
# Use this script to rapidly deploy basic and desired embedded development #
# packages. #
# Last revision: 15/04/2020 #
# #
################################################################################
# #
# Copyright (C) 2020, Radu Daia, Maze Electronics #
# Contact: radu.daia93@gmail.com #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
################################################################################
RECIPES_DIR="recipes"
RECIPES_LIST="\
arm \
browsers \
debug \
editors \
ides \
intel \
make \
source_control \
terminals \
yocto \
"
. ./utils.sh
printf "${cyn}[INFO]${end} ${mag}DEnvSet is starting up!${end}\n"
printf "${cyn}[INFO]${end} ${mag}Parsing recipes...${end}"
PACKAGES_LIST=""
for recipe in ${RECIPES_LIST}
do
# source recipes
. ./${RECIPES_DIR}/${recipe}/recipe
exceptions_list_name="EXCEPTION_${recipe^^}"
exceptions_list=${!exceptions_list_name}
exceptions_count=$(echo "${exceptions_list}" | wc -w)
# if packages that need special installation steps
# are required, then source file with routines to
# handle them
if [ $exceptions_count -gt 0 ]; then
. ./${RECIPES_DIR}/${recipe}/routines
fi
recipe_val=${recipe^^}
recipe_base_packages="BASE_${recipe_val}"
recipe_exception_packages="EXCEPTION_${recipe_val}"
for package in ${!recipe_val}
do
if [[ ${!recipe_base_packages} == *"${package}"* ]]; then
BASE_PACKAGES="${BASE_PACKAGES} ${package}"
else
EXCEPTION_PACKAGES="${EXCEPTION_PACKAGES} ${package}"
fi
done
done
printf "${grn}[DONE]${end}\n"
printf "${cyn}[INFO]${end} ${mag}Updating aptitude package manager.....${end}"
sudo apt-get update 2>&1 > /dev/null
printf "${grn}[DONE]${end}\n"
line="..............................."
arrow="|---->"
PACKAGES="${BASE_PACKAGES} ${EXCEPTION_PACKAGES}"
packages_count=$(echo "${PACKAGES}" | wc -w)
current_progress=0
progress_step=$(echo "scale=2; 100/${packages_count}" | bc)
printf "${cyn}[INFO]${end} ${blu}Installing package(s):${end}\n"
# install the trivial packages
for package in ${BASE_PACKAGES}
do
printf "${cyn}[INFO]${end} ${blu}${arrow}${end} ${yel}${package}${end}${line:${#package}}"
sudo apt-get -y install ${package} 2>&1 > /dev/null
current_progress=$(echo "scale=2; ${current_progress} + ${progress_step}" | bc)
printf "${grn}[DONE]${end}${red}[${current_progress}%%]${end}\n"
done
# install the more difficult packages
for package in ${EXCEPTION_PACKAGES}
do
printf "${cyn}[INFO]${end} ${blu}${arrow}${end} ${yel}${package}${end}${line:${#package}}"
install_${package}
current_progress=$(echo "scale=2; ${current_progress} + ${progress_step}" | bc)
printf "${grn}[DONE]${end}${red}[${current_progress}%%]${end}\n"
done
success_message="All packages installed!"
printf "${cyn}[INFO]${end} ${blu}\\----- ${success_message}${end}${line:${#success_message}}${red} [100.0%%]${end}\n"
echo "${cyn}[INFO]${end} ${mag}System setup finished successfully!${end}"