blob: 4ae4d48f7df828bcb656e6d0325316bbe005c1f9 (
plain) (
blame)
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
|
#!/usr/bin/env bash
# load our paths first
_BASE="$(realpath $0)"
_BASENAME="$(basename $_BASE)"
_BASEDIR="$(dirname $_BASE)"
# enter our host directory so we know where everything is
cd "$_BASEDIR"
# source all library files
for lib in lib/*; do source $lib; done
function intro() {
cat <<EOF
$(tput setab 4) $(tput sgr0) $(tput bold).dots$(tput sgr0)
$(tput setab 4) $(tput sgr0) $(tput bold)version 1$(tput sgr0)
EOF
}
function main() {
intro
MODULES=modules/**$1/install.sh
# perform preinstall tasks
PACKAGES=()
for module in $MODULES; do
# make sure we're not using something from previous runs
unset -f preinstall
# load the module
source $module
# if we have a newly defined preinstall function, enter the module directory and run it
if [[ "$(type -t preinstall)" == "function" ]]; then
cd "$_scriptdir"
preinstall
cd "$_BASEDIR"
fi
done
# install any requested packages
[[ ${#PACKAGES[@]} -gt 0 ]] && packages::install ${PACKAGES[@]}
# perform installation tasks
for module in $MODULES; do
# make sure we're not using something from previous runs
unset -f install
# load the module
source $module
# if we have a newly defined install function, enter the module directory and run it
if [[ "$(type -t install)" == "function" ]]; then
cd "$_scriptdir"
install
cd "$_BASEDIR"
fi
done
}
main $@
|