[build.sh] Now can specify VERSION with --version command

This commit is contained in:
ayakael 2018-12-30 09:41:41 -05:00
parent d69e15698c
commit 079c35d2de
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026

View file

@ -1,6 +1,22 @@
#!/bin/bash #!/bin/bash
EXEC=dam EXEC=dam
while true; do
case ${1} in
--version)
shift
VERSION="${1}"
;;
*)
break
;;
esac
shift
done
if [[ ! -d .git ]] && [[ -z ${VERSION+x} ]]; then echo "Not in git environement, please specify version via --version argument"; exit 1; fi
[[ -z ${VERSION+x} ]] && VERSION=$(git describe --tags)
test_function() { test_function() {
local functionList=(${@}) local functionList=(${@})
@ -29,7 +45,6 @@ gen_help() {
gen_env() { gen_env() {
echo -e "#!/bin/bash\n" echo -e "#!/bin/bash\n"
[[ $(git describe --tags) ]] && VERSION=$(git describe --tags) || VERSION=$(cat VERSION)
echo "VERSION=${VERSION}" echo "VERSION=${VERSION}"
echo "REPO_VERSION=1" echo "REPO_VERSION=1"
awk '!/^ *#/ && NF' src/env awk '!/^ *#/ && NF' src/env