1
0
forked from extern/alertik

Add commit hash on banner

This commit is contained in:
Davidson Francis 2024-05-30 20:49:35 -03:00
parent 4760bd2fbe
commit 18efb5f77e
2 changed files with 13 additions and 4 deletions

View File

@ -7,6 +7,7 @@ CC ?= cc
CFLAGS += -Wall -Wextra
LDLIBS += -pthread -lcurl
STRIP = strip
VERSION = v0.1
ifeq ($(LOG_FILE),yes)
CFLAGS += -DUSE_FILE_AS_LOG
@ -23,6 +24,11 @@ ifneq ($(CROSS),)
LDFLAGS += -no-pie --static
endif
GIT_HASH=$(shell git rev-parse --short HEAD 2>/dev/null || echo '$(VERSION)')
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
.PHONY: all clean
all: alertik Makefile
$(STRIP) --strip-all alertik

View File

@ -442,21 +442,24 @@ int main(void)
#endif
if (!TELEGRAM_BOT_TOKEN || !TELEGRAM_CHAT_ID || !TELEGRAM_NICKNAME) {
panic("Unable to find env vars, please check if you have all of the"
panic("Unable to find env vars, please check if you have all of the "
"following set:\n"
"- TELEGRAM_BOT_TOKEN\n"
"- TELEGRAM_CHAT_ID\n"
"- TELEGRAM_NICKNAME\n");
}
log_msg("Alertik v%s started...\n", ALERTIK_VERSION);
log_msg(
"Alertik (" GIT_HASH ") (built at " __DATE__ " " __TIME__ ")\n");
log_msg(" (https://github.com/Theldus/alertik)\n");
log_msg("-------------------------------------------------\n");
fd = create_socket();
if (pthread_create(&handler, NULL, handle_messages, NULL))
panic_errno("Unable to create hanler thread!");
log_msg("Waiting for messages...\n");
log_msg("Waiting for messages at :%d (UDP)...\n", SYSLOG_PORT);
while (read_new_upd_msg(fd) >= 0);
return (EXIT_SUCCESS);
return EXIT_SUCCESS;
}