Better OS detection.
[staging/xdg-launcher.git] / cmake / cmake.d / 02-variables.cmake
index e580263..285648f 100644 (file)
@@ -51,18 +51,20 @@ set(NPKG_PROJECT_NAME agl-${PROJECT_NAME})
 # Get the os type
 # Used to package .deb
 if(EXISTS "/etc/os-release")
-       execute_process(COMMAND grep -E "^ID(=|_LIKE=)" /etc/os-release
+       execute_process(COMMAND bash "-c" "grep -E '^ID(_LIKE)?=' /etc/os-release | tail -n 1"
                OUTPUT_VARIABLE TMP_OSRELEASE
        )
+
        if (NOT TMP_OSRELEASE STREQUAL "")
-               string(REGEX REPLACE ".*=" "" OSRELEASE ${TMP_OSRELEASE})
+               string(REGEX REPLACE ".*=\"?([0-9a-z\._-]*)\"?\n" "\\1" OSRELEASE ${TMP_OSRELEASE})
        else()
-               set(OSRELEASE "NOT DEBIAN OS")
+               set(OSRELEASE "NOT COMPATIBLE !")
        endif()
-       message(STATUS "OSRELEASE = ${OSRELEASE}")
+
 else()
-       set(OSRELEASE "NOT DEBIAN OS")
+       set(OSRELEASE "NOT COMPATIBLE ! Missing /etc/os-release file.")
 endif()
+message(STATUS "Distribution used ${OSRELEASE}")
 
 if(DEFINED ENV{SDKTARGETSYSROOT})
        file(STRINGS $ENV{SDKTARGETSYSROOT}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
@@ -163,6 +165,6 @@ set(GDB_INITIAL_BREAK "personality" CACHE STRING "Initial Break Point for GDB re
 # Define some checker binaries to verify input DATA files
 # to be included in package. Schema aren't checked for now.
 # Dummy checker about JSON.
-set(LUA_CHECKER "luac" CACHE STRING "LUA compiler")
+set(LUA_CHECKER "luac -o /dev/null" CACHE STRING "LUA compiler")
 set(XML_CHECKER "xmllint" CACHE STRING "XML linter")
 set(JSON_CHECKER "echo" CACHE STRING "JSON linter")