-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
49 lines (36 loc) · 1.23 KB
/
bootstrap.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
#!/usr/bin/env bash
info() {
tput bold;tput setaf "6";tput setab "7";echo "$1";tput sgr0;tput el;
}
# We have cd to directory to make sure find only searches in this directory
project_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$project_dir"
# Install all packages using snap, apt,...
info "[Install] all packages using snap, apt,..."
for file in Package_list/*; do
info "============================================"
info "======== $file ========"
info "============================================"
case $file in
"Package_list/apt_package.txt") cmd="apt -y" ;;
"Package_list/snap_package.txt") cmd="snap" ;;
esac
while read -r package; do
if [[ ${package:0:1} == "#" || $package == "" ]]; then continue; fi
info "[Install] $package"
sudo $cmd install $package
echo "------------------------------------------"
done < $file
done
# Install all packages
info "[Install] all packages"
for directory in Package/*; do
# find setup file then run it
find $directory -name "setup.sh" | while read setup; do
info "-------- $directory -----------"
# NOTE: We have to cd back to maintain relative path
cd "$project_dir"
info "[Install] $directory"
. ./$setup
done
done