Skip to content
Snippets Groups Projects
Unverified Commit 167423b7 authored by Massimiliano Adamo's avatar Massimiliano Adamo
Browse files

rename scripts

parent ffda86e6
No related branches found
No related tags found
No related merge requests found
...@@ -11,11 +11,11 @@ export BIN_NAME PATH GOPATH PROG_VERSION BUILDTIME ...@@ -11,11 +11,11 @@ export BIN_NAME PATH GOPATH PROG_VERSION BUILDTIME
REPO_DIR=$(dirname $0) REPO_DIR=$(dirname $0)
if [ "$REPO_DIR" = '.' ]; then if [ "$REPO_DIR" = '.' ]; then
REPO_DIR=`pwd` REPO_DIR=$(pwd)
fi fi
ln -sf "$REPO_DIR" "${GOPATH}/src/" ln -sf "$REPO_DIR" "${GOPATH}/src/"
REPO_NAME=$(basename "$REPO_DIR") REPO_NAME=$(basename "$REPO_DIR")
cd $REPO_NAME cd "${GOPATH}/src/$REPO_NAME"
#LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) #LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
#PROG_VERSION=$(echo $LATEST_TAG | sed -e 's/^v//') #PROG_VERSION=$(echo $LATEST_TAG | sed -e 's/^v//')
...@@ -29,9 +29,6 @@ run_upx() { ...@@ -29,9 +29,6 @@ run_upx() {
upx --brute ${GOPATH}/bin/${BIN_NAME} upx --brute ${GOPATH}/bin/${BIN_NAME}
} }
rm -rf ${GOPATH}/src/github.com/maxadamo/${BIN_NAME} ${GOPATH}/src/gitlab.geant.net/devops/${BIN_NAME}
#go get -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" gitlab.geant.net/devops/${BIN_NAME}
go get -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" . go get -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" .
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
echo -e "\nthere was an error while compiling the code\n" echo -e "\nthere was an error while compiling the code\n"
...@@ -40,6 +37,7 @@ fi ...@@ -40,6 +37,7 @@ fi
echo "" echo ""
while true; do while true; do
echo -e "\nUPX degrades performances but in the case of acme-downloader it is not noticeable\n"
read -p "Do you wish to run upx against ${BIN_NAME}? (y/n) " yn read -p "Do you wish to run upx against ${BIN_NAME}? (y/n) " yn
case $yn in case $yn in
[Yy]*) [Yy]*)
...@@ -48,7 +46,9 @@ while true; do ...@@ -48,7 +46,9 @@ while true; do
break break
;; ;;
[Nn]*) break ;; [Nn]*) break ;;
*) echo "Please answer yes or no." ;; *)
echo "Please answer Y|y or N|n."
;;
esac esac
done done
......
...@@ -17,35 +17,37 @@ ln -sf "$REPO_DIR" "${GOPATH}/src/" ...@@ -17,35 +17,37 @@ ln -sf "$REPO_DIR" "${GOPATH}/src/"
REPO_NAME=$(basename "$REPO_DIR") REPO_NAME=$(basename "$REPO_DIR")
cd "${GOPATH}/src/$REPO_NAME" cd "${GOPATH}/src/$REPO_NAME"
run_upx() {
if ! which upx &>/dev/null; then
echo "please download upx here https://github.com/upx/upx/releases"
echo "and store the executable within your \$PATH"
exit
fi
upx --brute ${GOPATH}/bin/${BIN_NAME}
}
# env GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" . # env GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" .
env GOOS=windows GOARCH=amd64 go get -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" . env GOOS=windows GOARCH=amd64 go get -ldflags "-s -w -X main.appVersion=${PROG_VERSION} -X main.buildTime=${BUILDTIME}" .
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
echo -e "\nthere was an error while compiling the code\n" echo -e "\nthere was an error while compiling the code\n"
exit exit
fi fi
echo ""
#run_upx() {
# if ! which upx &>/dev/null; then
# echo "please download upx here https://github.com/upx/upx/releases"
# echo "and store the executable within your \$PATH"
# exit
# fi
# upx --brute ${GOPATH}/bin/${BIN_NAME}
#}
#while true; do while true; do
# read -p "Do you wish to run upx against ${BIN_NAME}? (y/n) " yn echo -e "\nUPX degrades performances but in the case of acme-downloader it is not noticeable\n"
# case $yn in read -p "Do you wish to run upx against ${BIN_NAME}? (y/n) " yn
# [Yy]*) case $yn in
# echo "" [Yy]*)
# run_upx echo ""
# break run_upx
# ;; break
# [Nn]*) break ;; ;;
# *) echo "Please answer yes or no." ;; [Nn]*) break ;;
# esac *)
#done echo "Please answer Y|y or N|n."
;;
esac
done
#echo -e "\nthe binary was compiled and it is avilable as:\n - ${GOPATH}/bin/${BIN_NAME}\n" #echo -e "\nthe binary was compiled and it is avilable as:\n - ${GOPATH}/bin/${BIN_NAME}\n"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment