From f0921a41b2bca1fdf63373087338d9b90cffb949 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 20 Aug 2014 01:45:21 +0200 Subject: [PATCH] Try to find settings.conf from SYSCONFDIR Honor SYSCONFDIR as specified by CMake arguments instead of using a hard-coded path. Since GNUInstallDirs set CMAKE_INSTALL_FULL_SYSCONFDIR to CMAKE_INSTALL_PREFIX/etc we need to change the default ourselves. --- CMakeLists.txt | 7 +++++++ src/calamares/CalamaresApplication.cpp | 3 ++- src/libcalamares/CalamaresConfig.h.in | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7556da11b..1526848a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,13 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) +# Better default installation paths: GNUInstallDirs defines +# CMAKE_INSTALL_FULL_SYSCONFDIR to be CMAKE_INSTALL_PREFIX/etc by default +# but we really want /etc +if( NOT DEFINED CMAKE_INSTALL_SYSCONFDIR ) + set( CMAKE_INSTALL_SYSCONFDIR "/etc" ) +endif() + # make predefined install dirs available everywhere include( GNUInstallDirs ) diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index 36ab8d828..a3ff631af 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -18,6 +18,7 @@ #include #include "CalamaresApplication.h" +#include "CalamaresConfig.h" #include "CalamaresWindow.h" #include "CalamaresVersion.h" #include "progresstree/ProgressTreeView.h" @@ -156,7 +157,7 @@ CalamaresApplication::initSettings() QDir::separator() + "settings.conf" ); } - settingsFileCandidatesByPriority.append( "/etc/calamares/settings.conf" ); + settingsFileCandidatesByPriority.append( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf" ); settingsFileCandidatesByPriority.append( CalamaresUtils::appDataDir() .absoluteFilePath( "settings.conf" ) ); diff --git a/src/libcalamares/CalamaresConfig.h.in b/src/libcalamares/CalamaresConfig.h.in index 7d5ce35d1..31cbc926d 100644 --- a/src/libcalamares/CalamaresConfig.h.in +++ b/src/libcalamares/CalamaresConfig.h.in @@ -6,6 +6,7 @@ #define CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" #define CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}" #define CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/calamares" +#define CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}" //cmakedefines for CMake variables (e.g. for optdepends) go here #cmakedefine WITH_PYTHON