-
Notifications
You must be signed in to change notification settings - Fork 1
/
_platform_config.sh
52 lines (40 loc) · 1.32 KB
/
_platform_config.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
#!/bin/bash
# Constants
###########################
readonly platformWindows="Windows64"
readonly platformLinux="Linux64"
readonly platformNoarch="Noarch"
readonly localTarget="./target"
readonly linuxTarget="$localTarget/$platformLinux"
readonly windowsTarget="$localTarget/$platformWindows"
readonly noarchTarget="$localTarget/$platformNoarch"
readonly localTmp="$localTarget/_tmp"
readonly linuxTmp="$localTmp/$platformLinux"
readonly windowsTmp="$localTmp/$platformWindows"
readonly noarchTmp="$localTmp/$platformNoarch"
setCurrentPlatform() {
newPlatform="$1"
if [[ \
("$newPlatform" != "$platformLinux") && \
("$newPlatform" != "$platformWindows") && \
("$newPlatform" != "$platformNoarch") \
]]; then
echo "Error: newPlatform=$newPlatform not supported."
exit 1
fi
currentPlatform="$newPlatform"
# export is needed to pass variable to invoked skripts
export currentPlatform
echo "Info: set and exported currentPlatform=$currentPlatform"
# Export needed by public functions of _bash_config.sh
export currentTarget="$localTarget/$currentPlatform"
export currentTmp="$localTmp/$currentPlatform"
}
ensurePlatformInitialization() {
if [[ -z ${currentPlatform+x} ]]; then
#"CurrentPlatform is unset"
setCurrentPlatform "$standardPlatform"
fi
}
readonly standardPlatform="$platformLinux"
ensurePlatformInitialization