debugging: Add version

This commit is contained in:
Geoff Levand
2016-08-08 14:52:54 -07:00
parent 9ba2a923f4
commit dab4fbb5f8
2 changed files with 34 additions and 0 deletions

View File

@@ -19,6 +19,37 @@
## @start 1
#! /bin/sh
version=
if [ "$1" ]; then
version=$1
elif head=$(git rev-parse --short --verify HEAD 2>/dev/null); then
# If available, use the git commit revision for the package version.
# Add a date prefix for easy reading.
# date='2010-11-30 16:36:09 -0800'
date=$(git log --pretty=format:"%ci" -1 HEAD)
date=${date##20}
date=${date%%:[0-9][0-9] *}
date=$(echo ${date} | sed -e 's/[- :]/./g')
version=$(printf '%s-%s%s' ${date} g ${head})
# Add a '-dirty' postfix for uncommitted changes.
if git diff-index HEAD | read dummy; then
version=`printf '%s%s' ${version} -dirty`
fi
else
# Default to current date and time.
version="unknown-$(date +%y.%m.%d-%H.%M.%S)"
fi
echo "#define VERSION \"${version}\"" > version.h
set -x
aclocal -I config
autoheader

View File

@@ -50,6 +50,7 @@
#include "kexec-zlib.h"
#include "kexec-lzma.h"
#include <arch/options.h>
#include "../version.h"
unsigned long long mem_min = 0;
unsigned long long mem_max = ULONG_MAX;
@@ -1216,6 +1217,8 @@ int main(int argc, char *argv[])
};
static const char short_options[] = KEXEC_ALL_OPT_STR;
printf("kexec version: " VERSION "\n");
/*
* First check if --use-kexec-file-syscall is set. That changes lot of
* things