From fb8322e35f8b5d814f3b75c7212a6f1428aba62c Mon Sep 17 00:00:00 2001 From: Zhang Wei Date: Wed, 1 Mar 2017 16:40:07 +0800 Subject: [PATCH] Print version and git commit in hyperstart When start container, print git commit in hyperstart to show accurate version number. Signed-off-by: Zhang Wei --- src/Makefile.am | 3 ++- src/init.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index b5689081..6555c62b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,5 @@ -AM_CFLAGS = -Wall -Werror +COMMIT=`git describe --dirty --always --tags 2> /dev/null || true` +AM_CFLAGS = -Wall -Werror -DVERSIONCOMMIT=\""$(VERSION), commit: $(COMMIT)"\" bin_PROGRAMS=hyperstart hyperstart_SOURCES=init.c jsmn.c net.c util.c parse.c parson.c container.c exec.c event.c portmapping.c if HAVE_VSOCK diff --git a/src/init.c b/src/init.c index 71654e4d..92c0b96d 100644 --- a/src/init.c +++ b/src/init.c @@ -1460,6 +1460,9 @@ static int hyper_loop(void) static int hyper_setup_init_process(void) { /* mount the base file systems */ + printf("\n<**********************************************************************\n"); + printf("< Hyperstart Version: %s\n", VERSIONCOMMIT); + printf("<**********************************************************************\n"); if (mount("proc", "/proc", "proc", MS_NOSUID| MS_NODEV| MS_NOEXEC, NULL) == -1) { perror("mount proc failed"); return -1;