diff --git a/dshash/dshash b/dshash/dshash index 04f3670..1cc8e6f 100755 Binary files a/dshash/dshash and b/dshash/dshash differ diff --git a/dshash/main.cpp b/dshash/main.cpp index 46a964f..1c7b30d 100644 --- a/dshash/main.cpp +++ b/dshash/main.cpp @@ -4,8 +4,11 @@ #include #include +#define DSHASH_VERSION "__VERSION__" + void printUsage(const std::string& program) { std::cerr << "Usage: " << program << " [-v] \n"; + std::cerr << " " << program << " version\n"; std::cerr << " -v Verbose mode (list files as they are processed)\n"; } @@ -15,6 +18,12 @@ int main(int argc, char* argv[]) { return 1; } + // Check for version command + if (argc == 2 && std::string(argv[1]) == "version") { + std::cout << DSHASH_VERSION << std::endl; + return 0; + } + bool verbose = false; std::string path; diff --git a/dshash/main.o b/dshash/main.o index bb15ad1..18cf7db 100644 Binary files a/dshash/main.o and b/dshash/main.o differ diff --git a/publish.sh b/publish.sh index b571261..45437b7 100755 --- a/publish.sh +++ b/publish.sh @@ -6,6 +6,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" ARCH=$(uname -m) PROJECT="$(basename "${SCRIPT_DIR}")" OUTPUT="${SCRIPT_DIR}/output" +VERSION=$(date -u +"%Y.%m%d.%H%M") function heading() { echo "--------------------------------" @@ -30,10 +31,16 @@ mkdir -p "${OUTPUT}" #-------------------------------------------------------------------------------- heading "Building ${PROJECT}" +# Replace __VERSION__ in the source file before building +sed -i "s|__VERSION__|${VERSION}|g" "${SCRIPT_DIR}/dshash/main.cpp" + # build release version "${SCRIPT_DIR}/build.sh" [ -f "${OUTPUT}/${PROJECT}" ] || die "Build failed." +# Restore the placeholder for future builds +sed -i "s|${VERSION}|__VERSION__|g" "${SCRIPT_DIR}/dshash/main.cpp" + # install getpkg GETPKG_PATH="${HOME}/.local/bin/getpkg/getpkg" if [ ! -f "${GETPKG_PATH}" ]; then