forked from PredixDev/izon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathizon.sh
More file actions
executable file
·67 lines (61 loc) · 1.95 KB
/
Copy pathizon.sh
File metadata and controls
executable file
·67 lines (61 loc) · 1.95 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
#!/bin/bash
function __readDependency() {
local base_path="."
if [[ $4 != "" ]]; then
base_path=$4
fi
if [ -e $base_path/version.json ]; then
local dependency=$1
local url_var=$2
local tag_var=$3
local path=$(sed -n "/$dependency/p" $base_path/version.json | awk -F'"' '{print $4}')
local url=$(echo $path | awk -F"#" '{print $1}')
local tag=$(echo $path | awk -F"#" '{print $2}')
eval $url_var="$url"
eval $tag_var="$tag"
else
echo "Unable to find version.json file"
exit 1
fi
}
function __version() {
local base_path="."
if [ -n $1 ]; then
base_path=$1
fi
local version=""
if [ -e $base_path/VERSION ]; then
version=$(cat VERSION)
elif [ -e $base_path/version.json ]; then
version=$(grep version version.json | cut -f 2 -d: | cut -f 2 -d \")
else
echo "Unable to find VERSION/version.json file"
exit 1
fi
}
function getVersionFile() {
#if needed, get the version.json that resolves dependent repos from another github repo
if [ ! -f "$VERSION_JSON" ]; then
if [[ $currentDir == *"$REPO_NAME" ]]; then
if [[ ! -f manifest.yml ]]; then
echo "We noticed you are in a directory named $REPO_NAME but the usual contents are not here, please rename the dir or do a git clone of the whole repo. If you rename the dir, the script will get the repo."
exit 1
fi
fi
#echo $VERSION_JSON_URL
curl -s -O $VERSION_JSON_URL
fi
}
function getLocalSetupFuncs() {
#get the predix-scripts url and branch from the version.json
__readDependency $PREDIX_SCRIPTS PREDIX_SCRIPTS_URL PREDIX_SCRIPTS_BRANCH
LOCAL_SETUP_FUNCS_URL=https://raw.githubusercontent.com/brajpanda/$PREDIX_SCRIPTS/$PREDIX_SCRIPTS_BRANCH/bash/scripts/local-setup-funcs.sh
echo $LOCAL_SETUP_FUNCS_URL
if [ -f "local-setup-funcs.sh" ]; then
rm local-setup-funcs.sh
fi
if [ ! -f "local-setup-funcs.sh" ]; then
curl -s -O $LOCAL_SETUP_FUNCS_URL
fi
source local-setup-funcs.sh
}