From d7aa3ddbb571e8ef7464ebfcc9a3abf39960e721 Mon Sep 17 00:00:00 2001 From: joonicks Date: Mon, 16 Apr 2018 23:13:55 +0200 Subject: [PATCH] githash incl branch, sample conf guid note --- sample.conf | 4 +++- src/gencmd.c | 2 +- src/lib/git.sh | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100755 src/lib/git.sh diff --git a/sample.conf b/sample.conf index c64274b..d828935 100644 --- a/sample.conf +++ b/sample.conf @@ -71,7 +71,9 @@ link 4 ongabonga_pass ; ; create a new bot ; -; 1 the globally uniqe ID (guid), used for botnet linking +; 1 the globally uniqe ID (guid), used for botnet linking (0-65536) +; Note: dont use a common number unless you are dead certain that +; your bot will never link to any other. Changing guid can be a mess. ; emech3 the bots nick ; nick 1 emech3 diff --git a/src/gencmd.c b/src/gencmd.c index 83978d0..0e86544 100644 --- a/src/gencmd.c +++ b/src/gencmd.c @@ -513,7 +513,7 @@ void datestamp(void) void githash(void) { #ifdef HAVE_GIT - system("git log -n 1 | grep commit | sed -r 's/^commit (.{7}).*/#define GITHASH \" (git:\\1)\"/g;' > githash.h"); + system("./lib/git.sh > githash.h"); #else system("echo '#define GITHASH \"\"' > githash.h"); #endif diff --git a/src/lib/git.sh b/src/lib/git.sh new file mode 100755 index 0000000..162475f --- /dev/null +++ b/src/lib/git.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +hash=`git log -n 1 | sed -r 's/^commit (.{7}).*$/\1/g; 1!d'` +branch=`git status | sed -r 's/^On branch (.+)/\1/g; 1!d'` +echo '#define GITHASH " (git:'$branch'-'$hash')"' +