From c640dd70cc4229b07192a9739ece5f90d02151da Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Thu, 2 May 2019 22:49:40 -0700 Subject: [PATCH] Install local.zeek as symlink to pre-existing local.bro This a convenience for those that are upgrading. If we didn't do this, then deployments can silently break until the user intervenes since BroControl now prefers to load the initially-vanilla local.zeek instead of the formerly-customized local.bro. --- CHANGES | 9 +++++++++ NEWS | 11 +++++++---- VERSION | 2 +- scripts/CMakeLists.txt | 23 +++++++++++++++++++++-- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index c011e1ca3b..11e3ec5d8f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,13 @@ +2.6-263 | 2019-05-02 22:49:40 -0700 + + * Install local.zeek as symlink to pre-existing local.bro (Jon Siwek, Corelight) + + This a convenience for those that are upgrading. If we didn't do + this, then deployments can silently break until the user intervenes + since BroControl now prefers to load the initially-vanilla local.zeek + instead of the formerly-customized local.bro. + 2.6-262 | 2019-05-02 21:39:01 -0700 * Rename Zeexygen to Zeekygen (Jon Siwek, Corelight) diff --git a/NEWS b/NEWS index 16c51b3c2b..082ad782b1 100644 --- a/NEWS +++ b/NEWS @@ -80,10 +80,13 @@ Changed Functionality --------------------- - ``$prefix/share/bro/site/local.bro`` has been renamed to - ``local.zeek``. If you have made customizations to that file, it - will no longer be loaded by default by BroControl (ZeekControl), - but you can simply copy it to ``local.zeek`. You may also want to - remove old ``local.bro`` files to avoid potential confusion. + ``local.zeek``. If you have a ``local.bro`` file from a previous + installation, possibly with customizations made to it, the new + version of Zeek will install a ``local.zeek`` file that is a symlink + to the pre-existing ``local.bro``. In that case, you may want to + just copy ``local.bro`` into the new ``local.zeek`` location to + avoid confusion, but things are otherwise meant to work properly + without intervention. - All scripts ending in ``.bro`` that ship with the Zeek source tree have been renamed to ``.zeek``. diff --git a/VERSION b/VERSION index 1733e8d0df..733b341e51 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6-262 +2.6-263 diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 189c9b9df8..9a3f596add 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -8,8 +8,27 @@ install(DIRECTORY ./ DESTINATION ${BRO_SCRIPT_INSTALL_PATH} FILES_MATCHING PATTERN "*.fp" ) -# Install all local* scripts as config files since they are meant to be -# user modify-able. +if ( NOT BINARY_PACKAGING_MODE ) + # If the user has a local.bro file from a previous installation, prefer to + # symlink local.zeek to it to avoid breaking their custom configuration -- + # because BroControl will now prefer to load local.zeek rather than local.bro + # and we're about to install a default version of local.zeek. + + set(_local_bro_dst ${BRO_SCRIPT_INSTALL_PATH}/site/local.bro) + set(_local_zeek_dst ${BRO_SCRIPT_INSTALL_PATH}/site/local.zeek) + + install(CODE " + if ( \"\$ENV{DESTDIR}\" STREQUAL \"\" ) + if ( EXISTS \"${_local_bro_dst}\" AND NOT EXISTS \"${_local_zeek_dst}\" ) + message(STATUS \"WARNING: installed ${_local_zeek_dst} as symlink to ${_local_bro_dst}\") + execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink + \"${_local_bro_dst}\" \"${_local_zeek_dst}\") + endif () + endif () + ") +endif () + +# Install local script as a config file since it's meant to be modified directly. InstallPackageConfigFile( ${CMAKE_CURRENT_SOURCE_DIR}/site/local.zeek ${BRO_SCRIPT_INSTALL_PATH}/site