mirror of
https://github.com/neovim/neovim.git
synced 2025-12-11 17:12:40 +00:00
config: Allow setting USERNAME/HOSTNAME from the environment
Allowing this to be controlled externally improves reproducibility, as well as provides a more useful address to report for "Compiled by". For example, I intend to set it to the packaging list when building the Debian package. Signed-off-by: James McCoy <jamessan@jamessan.com>
This commit is contained in:
@@ -142,12 +142,16 @@ configure_file (
|
|||||||
find_program(WHOAMI_PROG whoami)
|
find_program(WHOAMI_PROG whoami)
|
||||||
find_program(HOSTNAME_PROG hostname)
|
find_program(HOSTNAME_PROG hostname)
|
||||||
|
|
||||||
if (NOT DEFINED USERNAME AND EXISTS ${WHOAMI_PROG})
|
if (DEFINED ENV{USERNAME})
|
||||||
|
set(USERNAME $ENV{USERNAME})
|
||||||
|
elseif (NOT DEFINED USERNAME AND EXISTS ${WHOAMI_PROG})
|
||||||
execute_process(COMMAND ${WHOAMI_PROG}
|
execute_process(COMMAND ${WHOAMI_PROG}
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
OUTPUT_VARIABLE USERNAME)
|
OUTPUT_VARIABLE USERNAME)
|
||||||
endif()
|
endif()
|
||||||
if (EXISTS ${HOSTNAME_PROG})
|
if (DEFINED ENV{HOSTNAME})
|
||||||
|
set(HOSTNAME $ENV{HOSTNAME})
|
||||||
|
elseif (EXISTS ${HOSTNAME_PROG})
|
||||||
execute_process(COMMAND ${HOSTNAME_PROG}
|
execute_process(COMMAND ${HOSTNAME_PROG}
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
OUTPUT_VARIABLE HOSTNAME)
|
OUTPUT_VARIABLE HOSTNAME)
|
||||||
|
|||||||
Reference in New Issue
Block a user