From 356282e77374dc7fd1dfe96fc481fb877b0e4196 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 200c9cb565..4cb639188f 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -1314,9 +1314,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}")