- one-shot to determine configuration base directory path from
RPM_CONFIGDIR environement or build-time default
- rpmfileutil is a bit strange place, this would really belong to librpm
but Lua initialization needs the path so...
#include "debug.h"
+static const char *rpm_config_dir = NULL;
+
static int open_dso(const char * path, pid_t * pidp, rpm_loff_t *fsizep)
{
static const char * cmd = NULL;
argvFree(dirs);
return rc;
}
+
+const char *rpmConfigDir(void)
+{
+ if (rpm_config_dir == NULL) {
+ char *rpmenv = getenv("RPM_CONFIGDIR");
+ rpm_config_dir = rpmenv ? xstrdup(rpmenv) : RPMCONFIGDIR;
+ }
+ return rpm_config_dir;
+}
*/
int rpmExpandNumeric (const char * arg);
+/** \ingroup rpmmacro
+ * Return rpm configuration base directory.
+ * If RPM_CONFIGDIR environment variable is set, it's value will be used.
+ * Otherwise the configuration directory is the one set at build time,
+ * typically /usr/lib/rpm. The value of rpmConfigDir() is determined
+ * on first call to this function and is guaranteed to remain the same
+ * on subsequent calls.
+ * @return rpm configuration directory name
+ */
+const char *rpmConfigDir(void);
+
#ifdef __cplusplus
}
#endif