|
|
@ -13,6 +13,7 @@ GOOS=linux |
|
|
|
GOARCH=amd64 |
|
|
|
GOARCH=amd64 |
|
|
|
FOLDER=/${WHOAMI:-$USER} |
|
|
|
FOLDER=/${WHOAMI:-$USER} |
|
|
|
RACE= |
|
|
|
RACE= |
|
|
|
|
|
|
|
VERBOSE= |
|
|
|
|
|
|
|
|
|
|
|
unset -v progdir |
|
|
|
unset -v progdir |
|
|
|
case "${0}" in |
|
|
|
case "${0}" in |
|
|
@ -50,6 +51,7 @@ OPTIONS: |
|
|
|
-b bucket set the upload bucket name (default: $BUCKET) |
|
|
|
-b bucket set the upload bucket name (default: $BUCKET) |
|
|
|
-f folder set the upload folder name in the bucket (default: $FOLDER) |
|
|
|
-f folder set the upload folder name in the bucket (default: $FOLDER) |
|
|
|
-r enable -race build option (default: $RACE) |
|
|
|
-r enable -race build option (default: $RACE) |
|
|
|
|
|
|
|
-v verbose build process (default: $VERBOSE) |
|
|
|
|
|
|
|
|
|
|
|
ACTION: |
|
|
|
ACTION: |
|
|
|
build build binaries only (default action) |
|
|
|
build build binaries only (default action) |
|
|
@ -87,7 +89,7 @@ function build_only |
|
|
|
if [[ -z "$build" || "$bin" == "$build" ]]; then |
|
|
|
if [[ -z "$build" || "$bin" == "$build" ]]; then |
|
|
|
rm -f $BINDIR/$bin |
|
|
|
rm -f $BINDIR/$bin |
|
|
|
echo "building ${SRC[$bin]}" |
|
|
|
echo "building ${SRC[$bin]}" |
|
|
|
env GOOS=$GOOS GOARCH=$GOARCH go build -v -x -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]} |
|
|
|
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]} |
|
|
|
if [ "$(uname -s)" == "Linux" ]; then |
|
|
|
if [ "$(uname -s)" == "Linux" ]; then |
|
|
|
$BINDIR/$bin -version |
|
|
|
$BINDIR/$bin -version |
|
|
|
fi |
|
|
|
fi |
|
|
@ -116,7 +118,7 @@ function upload |
|
|
|
if [ -e ${LIB[$lib]} ]; then |
|
|
|
if [ -e ${LIB[$lib]} ]; then |
|
|
|
$AWSCLI s3 cp ${LIB[$lib]} s3://${BUCKET}$FOLDER/$lib --acl public-read |
|
|
|
$AWSCLI s3 cp ${LIB[$lib]} s3://${BUCKET}$FOLDER/$lib --acl public-read |
|
|
|
else |
|
|
|
else |
|
|
|
echo "!! MISSING $lib !!" |
|
|
|
echo "!! MISSING ${LIB[$lib]} !!" |
|
|
|
fi |
|
|
|
fi |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
@ -153,7 +155,7 @@ function upload_wallet |
|
|
|
if [ -e ${LIB[$lib]} ]; then |
|
|
|
if [ -e ${LIB[$lib]} ]; then |
|
|
|
$AWSCLI s3 cp ${LIB[$lib]} s3://${PUBBUCKET}/$DESTDIR/$lib --acl public-read |
|
|
|
$AWSCLI s3 cp ${LIB[$lib]} s3://${PUBBUCKET}/$DESTDIR/$lib --acl public-read |
|
|
|
else |
|
|
|
else |
|
|
|
echo "!! MISSING $lib !!" |
|
|
|
echo "!! MISSING ${LIB[$lib]} !!" |
|
|
|
fi |
|
|
|
fi |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
@ -161,7 +163,7 @@ function upload_wallet |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
################################ MAIN FUNCTION ############################## |
|
|
|
################################ MAIN FUNCTION ############################## |
|
|
|
while getopts "hp:a:o:b:f:r" option; do |
|
|
|
while getopts "hp:a:o:b:f:rv" option; do |
|
|
|
case $option in |
|
|
|
case $option in |
|
|
|
h) usage ;; |
|
|
|
h) usage ;; |
|
|
|
p) PROFILE=$OPTARG ;; |
|
|
|
p) PROFILE=$OPTARG ;; |
|
|
@ -170,6 +172,7 @@ while getopts "hp:a:o:b:f:r" option; do |
|
|
|
b) BUCKET=$OPTARG/ ;; |
|
|
|
b) BUCKET=$OPTARG/ ;; |
|
|
|
f) FOLDER=$OPTARG ;; |
|
|
|
f) FOLDER=$OPTARG ;; |
|
|
|
r) RACE=-race ;; |
|
|
|
r) RACE=-race ;; |
|
|
|
|
|
|
|
v) VERBOSE='-v -x' ;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|