-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitinstall.sh
executable file
·53 lines (46 loc) · 1.08 KB
/
gitinstall.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
52
53
#!/bin/bash
ACTION=$1; shift
PASS_PARAMS=""
case $ACTION in
-h|--help|help)
echo "Install:"
echo "# helm git install https://github.com/helm/charts/stable/aerospike -b=master -n test"
echo "Upgrade:"
echo "# helm git upgrade test https://github.com/helm/charts/stable/aerospike -b=master --set=id=a"
exit
;;
upgrade)
PRE_PASS_PARAMS=$1; shift
CHART_URL=$1; shift
;;
install)
CHART_URL=$1; shift
;;
*)
echo "command not available"
echo "Please use 'helm git -h' for more info"
exit 1
;;
esac
for i in "$@"
do
case $i in
-b=*|--branch=*)
BRANCH="${i#*=}"
shift # past argument=value
;;
*)
PASS_PARAMS="$PASS_PARAMS $i"
;;
esac
done
if [ -z "$BRANCH" ]; then
BRANCH="master"
fi
REPO=$(echo $CHART_URL | sed -E 's (https://[^/]*/[^/]*/[^/]*).* \1 ')
REPO_PATH=$(echo $CHART_URL | sed -E 's https://[^/]*/[^/]*/[^/]*/ ')
SVN=$REPO.git/branches/$BRANCH/$REPO_PATH
TMP=$(mktemp -d)
svn export $SVN $TMP/tmp > /dev/null
eval "$(which helm) $ACTION $PRE_PASS_PARAMS $TMP/tmp $PASS_PARAMS"
rm -rf $TMP