Implement IcingaSysconfDir variable.

Refs #5224
This commit is contained in:
Gunnar Beutner 2013-11-27 09:23:30 +01:00
parent ed48934ed4
commit 9d8edd286f
5 changed files with 27 additions and 1 deletions

View File

@ -7,6 +7,7 @@
#cmakedefine HAVE_VFORK
#define ICINGA_PREFIX "${CMAKE_INSTALL_PREFIX}"
#define ICINGA_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}"
#define ICINGA_LOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}"
#define ICINGA_PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/icinga2"

View File

@ -1,10 +1,11 @@
## <a id="global-variables"> Global Variables
## <a id="global-variables"></a> Global Variables
Icinga 2 provides a number of special global variables:
Variable |Description
--------------------------|-------------------
IcingaPrefixDir |**Read-only.** Contains the installation prefix that was specified with cmake -DCMAKE_INSTALL_PREFIX. Defaults to /usr/local
IcingaSysconfDir |**Read-only.** Contains the path of the sysconf directory. Defaults to IcingaPrefixDir + "/etc".
IcingaLocalStateDir |**Read-only.** Contains the path of the local state directory. Defaults to IcingaPrefixDir + "/var".
IcingaPkgDataDir |**Read-only.** Contains the path of the package data directory. Defaults to IcingaPrefixDir + "/share/icinga2".
IcingaStatePath |**Read-write.** Contains the path of the Icinga 2 state file. Defaults to IcingaLocalStateDir + "/lib/icinga2/icinga2.state".

View File

@ -198,6 +198,7 @@ int main(int argc, char **argv)
Application::InstallExceptionHandlers();
Application::DeclarePrefixDir(ICINGA_PREFIX);
Application::DeclareSysconfDir(ICINGA_SYSCONFDIR);
Application::DeclareLocalStateDir(ICINGA_LOCALSTATEDIR);
Application::DeclarePkgDataDir(ICINGA_PKGDATADIR);

View File

@ -609,6 +609,26 @@ void Application::DeclarePrefixDir(const String& path)
ScriptVariable::Declare("IcingaPrefixDir", path);
}
/**
* Retrives the path of the sysconf dir.
*
* @returns The path.
*/
String Application::GetSysconfDir(void)
{
return ScriptVariable::Get("IcingaSysconfDir");
}
/**
* Sets the path of the sysconf dir.
*
* @param path The new path.
*/
void Application::DeclareSysconfDir(const String& path)
{
ScriptVariable::Declare("IcingaSysconfDir", path);
}
/**
* Retrieves the path for the local state dir.
*

View File

@ -73,6 +73,9 @@ public:
static String GetPrefixDir(void);
static void DeclarePrefixDir(const String& path);
static String GetSysconfDir(void);
static void DeclareSysconfDir(const String& path);
static String GetLocalStateDir(void);
static void DeclareLocalStateDir(const String& path);