-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup
More file actions
131 lines (84 loc) · 2.87 KB
/
setup
File metadata and controls
131 lines (84 loc) · 2.87 KB
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
#!/usr/bin/env bash
################################################################################
### Set bash environment error management
set -eu
################################################################################
### Start fresh
clear
################################################################################
### Determine script execution directory and install directory.
if [ -L "${BASH_SOURCE}" ]
then
### This file is being executed via a symlink.
### Identify the parent directory of the target file
link_target="$(readlink ${BASH_SOURCE})"
exec_dir="${link_target%/*}"
else
### This file is being directly executed.
### Identify our parent directory.
exec_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
fi
exec_dir_trim_2="$( echo ${exec_dir} | cut -f 1,2,3 -d'/')"
exec_dir_trim_3="$( echo ${exec_dir} | cut -f 1,2,3,4 -d'/')"
if [ -f "${exec_dir_trim_2}/functions" ]
then
exec_dir_root="${exec_dir_trim_2}"
else
if [ -f "${exec_dir_trim_3}/functions" ]
then
exec_dir_root="${exec_dir_trim_3}"
else
echo "Functions file not found in any second or third level parent directory of: | ${exec_dir} |."
echo
echo "Exiting..."
echo
exit 1
fi
fi
### Source local functions file.
. "$exec_dir_root/functions"
################################################################################
### Define formatting
synthia-define_formatting
################################################################################
### Check for root user runtime
synthia-check_root
################################################################################
### Head setup
echo "${g-}${b-}Initiating setup...${x-}"
echo
################################################################################
### Evaluate command arguments for custom-version install
while getopts ":d:p:" arguments
do
case $arguments in
d) export custom_dna_version="${OPTARG}"
;;
p) export custom_project_version="${OPTARG}"
;;
\?) echo "${r-}${b-}Invalid option | ${n-}-$OPTARG${r-} | for function | ${n-}${FUNCNAME[0]}${r-} |.${x-}"
echo
echo "${b-}Exiting...${x-}"
echo
exit 1
;;
esac
done
OPTIND=1
### If not using local version of project repo...
if [ ! "${custom_project_version-null}" = "l" ]
then
### Reset the repo to HEAD before proceeding with anything
( cd "${exec_dir_root}" && git fetch && git reset --hard origin/master > /dev/null )
fi
### Download dna
synthia-download_dna
### Source dna
synthia-source_dna
################################################################################
### Define variables
synthia-define_vars
################################################################################
### Actually run the installer
dna-run_install
################################################################################