-
Notifications
You must be signed in to change notification settings - Fork 17
/
uploadBuildpack.sh
executable file
·35 lines (32 loc) · 1.08 KB
/
uploadBuildpack.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
#!/bin/bash
# Copyright (c) 2016, TIBCO Software Inc. All rights reserved.
# You may not use this file except in compliance with the license
# terms contained in the TIBCO License.md file provided with this file.
if [[ $# -lt 1 || $# -gt 3 ]]; then
echo "Usage: ./uploadBuildpack.sh <path/to/bwce-buildpack.zip> <buildpack-Name><options>"
printf "\t %s \t\t %s \n\t\t\t\t %s \n" "Location of buildpack zip(bwce-buildpack.zip)"
printf "\t %s \t\t %s \n\t\t\t\t %s \n" "Buildpack name"
printf "\t %s \t\t\t %s \n" "-test" "Test uploaded buildpack"
exit 1
fi
if [ -z "$2" ]; then
buildpackName="bwce-buildpack"
else
buildpackName=$2
fi
OUTPUT=`cf buildpacks | grep "^${buildpackName}\\s"`
echo $OUTPUT
if [ -z "$OUTPUT" ]; then
echo 'Creating buildpack...'
cf create-buildpack ${buildpackName} $1 1
else
echo 'Updating buildpack...'
cf update-buildpack ${buildpackName} -p $1 -i 1
fi
if [ "$3" == "-test" ]; then
if [[ "$PWD" == *bwce-buildpack/build* ]]; then
cd ..
fi
cd test
./testBuildpack.sh ${buildpackName}
fi