From 12563e5b6120d32c92c7ae65d6079b1a0352d002 Mon Sep 17 00:00:00 2001 From: Benjamen Meyer Date: Sun, 22 Oct 2023 23:15:35 -0400 Subject: [PATCH] Bug Fix: Check for /etc/debian_version Check that /etc/debian_version exists Before relying on it existing. NOTE: THe logic was originally setup for Debian distros; however, when run on a non-Debian distro with the Debian Packaging tools installed this file does not exist and in some cases it can cause a problem. --- engine/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 79afa46c0c..938a730178 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -1402,9 +1402,16 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) SET(CPACK_DEBIAN_PACKAGE_VERSION "${VEGASTRIKE_PKG_VERSION_STR}") # Debian Version: /etc/debian_version - / IF (NOT LSB_EXISTS) + # this still needs to be true so LSB variables are not used below + # even if we don't detect the /etc/debian_version file SET(USE_DEBIAN_VERSION TRUE) - FILE(READ "/etc/debian_version" DEBIAN_VERSION_DATA) - STRING(REGEX MATCH "^(.+)\/.*$" DEBIAN_VERSION_DATA DEBIAN_RELEASE_VERSION) + IF (EXISTS "/etc/debian_version") + FILE(READ "/etc/debian_version" DEBIAN_VERSION_DATA) + STRING(REGEX MATCH "^(.+)\/.*$" DEBIAN_VERSION_DATA DEBIAN_RELEASE_VERSION) + ELSE (EXISTS "/etc/debian_version") + MESSAGE("Detected dpkg-release but Debian Distro is unknown") + SET(DEBIAN_RELEASE_VERSION "Unknown") + ENDIF (EXISTS "/etc/debian_version") ELSE (NOT LSB_EXISTS) SET(USE_DEBIAN_VERSION FALSE) SET(DEBIAN_RELEASE_VERSION "Debian Derivative Release Version ${LSB_LINUX_DISTRIBUTION_CODENAME}")