diff --git a/scripts/build_pkg_native.sh b/scripts/build_pkg_native.sh index 8e3f3488..2e42399f 100755 --- a/scripts/build_pkg_native.sh +++ b/scripts/build_pkg_native.sh @@ -25,6 +25,8 @@ fi #git submodule foreach --recursive "git clean -dxf && git reset --hard" #git submodule update --recursive --init +$(dirname $0)/check-db-version-consistency + echo "#define GIT_REVISION \"`git describe --dirty --always --long` `git describe --all`\"" > server/version.h if [[ $DIST == centos* ]] diff --git a/scripts/check-db-version-consistency b/scripts/check-db-version-consistency new file mode 100755 index 00000000..2cf11e83 --- /dev/null +++ b/scripts/check-db-version-consistency @@ -0,0 +1,14 @@ +#!/bin/bash +set -euo pipefail + +pushd "$(dirname "$0")"/.. >/dev/null + +LAST_UPGRADE="$(ls misc/sql/mysql-upgrade | sort -n -r | head -n 1)" +if ! [[ "$(< misc/sql/installed_db_version)" == "$LAST_UPGRADE" ]]; then + cat >&2 <<-EOF + Fix misc/sql/installed_db_version to be $LAST_UPGRADE + echo $LAST_UPGRADE > misc/sql/installed_db_version + git add misc/sql/installed_db_version + EOF + exit 1 +fi diff --git a/scripts/git-pre-commit b/scripts/git-pre-commit index 31bfda16..bacea6cb 100755 --- a/scripts/git-pre-commit +++ b/scripts/git-pre-commit @@ -1,12 +1,4 @@ #!/bin/bash set -euo pipefail -LAST_UPGRADE="$(ls misc/sql/mysql-upgrade | sort -n -r | head -n 1)" -if ! [[ "$(< misc/sql/installed_db_version)" == "$LAST_UPGRADE" ]]; then - cat >&2 <<-EOF - Fix misc/sql/installed_db_version to be $LAST_UPGRADE - echo $LAST_UPGRADE > misc/sql/installed_db_version - git add misc/sql/installed_db_version - EOF - exit 1 -fi +$(dirname $0)/check-db-version-consistency