When building standalone ctdb from git repo, samba_version_file correctly
includes git sha in VERSION string. When building standalone ctdb from
tarball, samba_version_file puts UNKNOWN in the VERSION string.
Use the packaged include/ctdb_version.h file to set the correct git sha.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
;;
esac
+else
+
+ # If building from tarball, Samba version creation will create
+ # VERSION with UNKNOWN git hash.
+ case "$VERSION" in
+ *UNKNOWN)
+ if [ -f ../include/ctdb_version.h ] ; then
+ VERSION=$(awk -F \" '/CTDB_VERSION_STRING/ {print $2}' ../include/ctdb_version.h)
+ fi
+ ;;
+ esac
fi
cat > "$OUTPUT" <<EOF
-/* This file is auto-genrated by packaging/mkversion.sh */
+/* This file is auto-generated by packaging/mkversion.sh */
#define CTDB_VERSION_STRING "$VERSION"
#include "lib/util/debug.h"
#include "lib/util/samba_util.h"
-#include "../include/ctdb_version.h"
+#include "ctdb_version.h"
#include "ctdb_private.h"
#include "ctdb_client.h"
#include "ctdb_logging.h"
#include "lib/util/time.h"
#include "ctdb_logging.h"
-#include "../include/ctdb_version.h"
+#include "ctdb_version.h"
#include "ctdb_private.h"
#include "ctdb_client.h"