Skip to content

Commit

Permalink
Merge pull request #1476 from pi-hole/new/git_hash
Browse files Browse the repository at this point in the history
Add hash printing and restore local compilation
  • Loading branch information
PromoFaux authored Nov 14, 2022
2 parents 6075a70 + b63a372 commit b48b3e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ else()
endif()

# Do we want to compile an all-in FTL version?
if($ENV{CI_ARCH} STREQUAL "x86_64_full")
if(DEFINED ENV{CI_ARCH})
if($ENV{CI_ARCH} STREQUAL "x86_64_full")
add_definitions(-DDNSMASQ_ALL_OPTS)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
find_package(DBus REQUIRED)
Expand All @@ -231,6 +232,7 @@ if($ENV{CI_ARCH} STREQUAL "x86_64_full")
find_library(LIBNFNETLINK nfnetlink)
find_library(LIBNETFILTER_CONNTRACK netfilter_conntrack)
target_link_libraries(pihole-FTL ${LIBMNL} ${LIBNFTABLES} ${LIBNFTNL} ${LIBNFNETLINK} ${LIBNETFILTER_CONNTRACK})
endif()
endif()

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
Expand Down
6 changes: 6 additions & 0 deletions src/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ void parse_args(int argc, char* argv[])
exit(EXIT_SUCCESS);
}

if(strcmp(argv[i], "--hash") == 0)
{
printf("%s\n",GIT_HASH);
exit(EXIT_SUCCESS);
}

// Don't go into background
if(strcmp(argv[i], "-f") == 0 ||
strcmp(argv[i], "no-daemon") == 0)
Expand Down
4 changes: 2 additions & 2 deletions src/gen_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if(DEFINED ENV{GIT_HASH})
set(GIT_HASH "$ENV{GIT_HASH}")
else()
execute_process(
COMMAND git --no-pager describe --always --dirty
COMMAND git --no-pager describe --always --abbrev=8 --dirty
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HASH
ERROR_QUIET
Expand All @@ -36,7 +36,7 @@ if(DEFINED ENV{GIT_VERSION})
set(GIT_VERSION "$ENV{GIT_VERSION}")
else()
execute_process(
COMMAND git --no-pager describe --tags --always --dirty
COMMAND git --no-pager describe --tags --always --abbrev=8 --dirty
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
ERROR_QUIET
Expand Down

0 comments on commit b48b3e1

Please sign in to comment.