-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathconfigure
executable file
·32 lines (28 loc) · 1.19 KB
/
configure
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
#!/bin/bash
function subutai() {
if [ "$1" != "" ]; then
echo "subutai-$1"
else
echo "subutai"
fi
}
if [ "$1" != "" ]; then
branch="$1"
else
branch="$(git rev-parse --abbrev-ref HEAD | grep -iv head)"
fi
snap_version="$(git describe --tags)"
cp snapcraft.yaml.templ snapcraft.yaml
if [ "$branch" == "" ]; then
p2p_version="$(git ls-remote --tags https://github.com/subutai-io/p2p.git | grep -o '[0-9]*\.[0-9]*\.[0-9]*' | sort -t'.' -nk1,1 -nk2,2 -nk3,3 -ur | head -1)"
agent_version="$(git ls-remote --tags https://github.com/subutai-io/agent.git | grep -o '[0-9]*\.[0-9]*\.[0-9]*' | sort -t'.' -nk1,1 -nk2,2 -nk3,3 -ur | head -1)"
sed -e "s/source-branch:\ (AGENT_BRANCH)/source-tag:\ $agent_version/g" -i snapcraft.yaml
sed -e "s/source-branch:\ (P2P_BRANCH)/source-tag:\ $p2p_version/g" -i snapcraft.yaml
sed -e "s/-(SNAP_BRANCH)//g" -i snapcraft.yaml
else
sed -e "s/(SNAP_BRANCH)/$branch/g" -i snapcraft.yaml
sed -e "s/(AGENT_BRANCH)/$branch/g" -i snapcraft.yaml
sed -e "s/(P2P_BRANCH)/$branch/g" -i snapcraft.yaml
fi
sed -e "s/(SNAP_VERSION)/$snap_version/g" -i snapcraft.yaml
sed -e "s/(SUBUTAI)/$(subutai $branch)/g" -i snapcraft.yaml