[svn-commits] tilghman: trunk r83726 - in /trunk: Makefile main/asterisk.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Sep 24 17:06:19 CDT 2007


Author: tilghman
Date: Mon Sep 24 17:06:19 2007
New Revision: 83726

URL: http://svn.digium.com/view/asterisk?view=rev&rev=83726
Log:
Permit custom locations for astdb and the keys directory (though default to the current locations) (Closes issue #10267)

Modified:
    trunk/Makefile
    trunk/main/asterisk.c

Modified: trunk/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/Makefile?view=diff&rev=83726&r1=83725&r2=83726
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Mon Sep 24 17:06:19 2007
@@ -108,6 +108,8 @@
   ASTETCDIR=/var/etc/asterisk
   ASTLIBDIR=/opt/asterisk/lib
   ASTVARLIBDIR=/var/opt/asterisk
+  ASTDBDIR=$(ASTVARLIBDIR)
+  ASTKEYDIR=$(ASTVARLIBDIR)
   ASTSPOOLDIR=/var/spool/asterisk
   ASTLOGDIR=/var/log/asterisk
   ASTHEADERDIR=/opt/asterisk/include
@@ -128,9 +130,12 @@
 ifneq ($(findstring BSD,$(OSARCH)),)
   ASTVARLIBDIR=$(prefix)/share/asterisk
   ASTVARRUNDIR=$(localstatedir)/run/asterisk
+  ASTDBDIR=$(localstatedir)/db/asterisk
 else
   ASTVARLIBDIR=$(localstatedir)/lib/asterisk
-endif
+  ASTDBDIR=$(ASTVARLIBDIR)
+endif
+  ASTKEYDIR=$(ASTVARLIBDIR)
 endif
 ifeq ($(ASTDATADIR),)
   ASTDATADIR:=$(ASTVARLIBDIR)
@@ -556,6 +561,8 @@
 		echo "astetcdir => $(ASTETCDIR)" ; \
 		echo "astmoddir => $(MODULES_DIR)" ; \
 		echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
+		echo "astdbdir => $(ASTDBDIR)" ; \
+		echo "astkeydir => $(ASTKEYDIR)" ; \
 		echo "astdatadir => $(ASTDATADIR)" ; \
 		echo "astagidir => $(AGI_DIR)" ; \
 		echo "astspooldir => $(ASTSPOOLDIR)" ; \

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=83726&r1=83725&r2=83726
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Mon Sep 24 17:06:19 2007
@@ -2301,6 +2301,10 @@
 	char *config = AST_CONFIG_FILE;
 	char hostname[MAXHOSTNAMELEN] = "";
 	struct ast_flags config_flags = { 0 };
+	struct {
+		unsigned int dbdir:1;
+		unsigned int keydir:1;
+	} found = { 0, 0 };
 
 	if (ast_opt_override_config) {
 		cfg = ast_config_load(ast_config_AST_CONFIG_FILE, config_flags);
@@ -2348,10 +2352,18 @@
 			snprintf(ast_config_AST_MONITOR_DIR, sizeof(ast_config_AST_MONITOR_DIR) - 1, "%s/monitor", v->value);
 		} else if (!strcasecmp(v->name, "astvarlibdir")) {
 			ast_copy_string(ast_config_AST_VAR_DIR, v->value, sizeof(ast_config_AST_VAR_DIR));
+			if (!found.dbdir)
+				snprintf(ast_config_AST_DB, sizeof(ast_config_AST_DB), "%s/astdb", v->value);
+		} else if (!strcasecmp(v->name, "astdbdir")) {
 			snprintf(ast_config_AST_DB, sizeof(ast_config_AST_DB), "%s/astdb", v->value);
+			found.dbdir = 1;
 		} else if (!strcasecmp(v->name, "astdatadir")) {
 			ast_copy_string(ast_config_AST_DATA_DIR, v->value, sizeof(ast_config_AST_DATA_DIR));
+			if (!found.keydir)
+				snprintf(ast_config_AST_KEY_DIR, sizeof(ast_config_AST_KEY_DIR), "%s/keys", v->value);
+		} else if (!strcasecmp(v->name, "astkeydir")) {
 			snprintf(ast_config_AST_KEY_DIR, sizeof(ast_config_AST_KEY_DIR), "%s/keys", v->value);
+			found.keydir = 1;
 		} else if (!strcasecmp(v->name, "astlogdir")) {
 			ast_copy_string(ast_config_AST_LOG_DIR, v->value, sizeof(ast_config_AST_LOG_DIR));
 		} else if (!strcasecmp(v->name, "astagidir")) {




More information about the svn-commits mailing list