[asterisk-commits] trunk r20330 - in /trunk: ./ build_tools/ include/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Apr 15 15:53:57 MST 2006


Author: file
Date: Sat Apr 15 17:53:53 2006
New Revision: 20330

URL: http://svn.digium.com/view/asterisk?rev=20330&view=rev
Log:
We are shaking up trunk tonight! allow data dir to be specified (issue #6967 reported by tzafrir)

Modified:
    trunk/Makefile
    trunk/app.c
    trunk/asterisk.c
    trunk/build_tools/make_defaults_h
    trunk/file.c
    trunk/http.c
    trunk/image.c
    trunk/include/asterisk.h
    trunk/res/res_agi.c

Modified: trunk/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/Makefile?rev=20330&r1=20329&r2=20330&view=diff
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Sat Apr 15 17:53:53 2006
@@ -167,12 +167,13 @@
   ASTMANDIR=$(INSTALL_PREFIX)/usr/share/man
 endif
 endif
+ASTDATADIR?=$(ASTVARLIBDIR)
 
 # Asterisk.conf is located in ASTETCDIR or by using the -C flag
 # when starting Asterisk
 ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
 MODULES_DIR=$(ASTLIBDIR)/modules
-AGI_DIR=$(ASTVARLIBDIR)/agi-bin
+AGI_DIR=$(ASTDATADIR)/agi-bin
 
 # If you use Apache, you may determine by a grep 'DocumentRoot' of your httpd.conf file
 HTTP_DOCSDIR=/var/www/html
@@ -566,42 +567,42 @@
 	# Should static HTTP be installed during make samples or even with its own target ala
 	# webvoicemail?  There are portions here that *could* be customized but might also be
 	# improved a lot.  I'll put it here for now.
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/static-http
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/static-http
 	for x in static-http/*; do \
-		install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/static-http ; \
-	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/priv-callerintros
+		install -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
+	done
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/digits
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/priv-callerintros
 	for x in sounds/digits/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/digits ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/dictate
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/dictate
 	for x in sounds/dictate/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/dictate ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/dictate ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/letters
 	for x in sounds/letters/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/letters ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/letters ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds/phonetic
 	for x in sounds/phonetic/*.gsm; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/phonetic ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds/phonetic ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
@@ -609,16 +610,16 @@
 	done
 	for x in sounds/demo-* sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-* sounds/queue-* sounds/spy-* sounds/priv-* sounds/screen-* sounds/hello-*; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/mohmp3
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/images
 	for x in images/*.jpg; do \
-		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
 	done
 	mkdir -p $(DESTDIR)$(AGI_DIR)
 
@@ -678,7 +679,7 @@
 	if [ -n "$(OLDHEADERS)" ]; then \
 		rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
 	fi
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
 	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-custom
 	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys
@@ -779,6 +780,7 @@
 		echo "astetcdir => $(ASTETCDIR)" ; \
 		echo "astmoddir => $(MODULES_DIR)" ; \
 		echo "astvarlibdir => $(ASTVARLIBDIR)" ; \
+		echo "astdatadir => $(ASTDATADIR)" ; \
 		echo "astagidir => $(AGI_DIR)" ; \
 		echo "astspooldir => $(ASTSPOOLDIR)" ; \
 		echo "astrundir => $(ASTVARRUNDIR)" ; \
@@ -796,28 +798,28 @@
 	else \
 		echo "Skipping asterisk.conf creation"; \
 	fi
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/sounds ; \
 	for x in sounds/demo-*; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
-			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
+			$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/sounds ; \
 		else \
 			echo "No description for $$x"; \
 			exit 1; \
 		fi; \
 	done
-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
+	mkdir -p $(DESTDIR)$(ASTDATADIR)/mohmp3 ; \
 	for x in sounds/*.mp3; do \
-		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
-	done
-	rm -f $(DESTDIR)$(ASTVARLIBDIR)/mohmp3/sample-hold.mp3
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/mohmp3 ; \
+	done
+	rm -f $(DESTDIR)$(ASTDATADIR)/mohmp3/sample-hold.mp3
 	mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
 	:> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
 	for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
-		cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
+		cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
 	done
 	:> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
 	for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
-		cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
+		cat $(DESTDIR)$(ASTDATADIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
 	done
 
 webvmail:
@@ -939,7 +941,7 @@
 	rm -f $(DESTDIR)$(ASTSBINDIR)/astgenkey
 	rm -f $(DESTDIR)$(ASTSBINDIR)/autosupport
 	rm -rf $(DESTDIR)$(ASTHEADERDIR)
-	rm -rf $(DESTDIR)$(ASTVARLIBDIR)/sounds
+	rm -rf $(DESTDIR)$(ASTDATADIR)/sounds
 	rm -rf $(DESTDIR)$(ASTVARLIBDIR)/firmware
 	rm -rf $(DESTDIR)$(ASTMANDIR)/man8
 	for x in $(SUBDIRS); do $(MAKE) -C $$x uninstall || exit 1 ; done
@@ -961,6 +963,7 @@
 uninstall-all: _uninstall
 	rm -rf $(DESTDIR)$(ASTLIBDIR)
 	rm -rf $(DESTDIR)$(ASTVARLIBDIR)
+	rm -rf $(DESTDIR)$(ASTDATADIR)
 	rm -rf $(DESTDIR)$(ASTSPOOLDIR)
 	rm -rf $(DESTDIR)$(ASTETCDIR)
 	rm -rf $(DESTDIR)$(ASTLOGDIR)

Modified: trunk/app.c
URL: http://svn.digium.com/view/asterisk/trunk/app.c?rev=20330&r1=20329&r2=20330&view=diff
==============================================================================
--- trunk/app.c (original)
+++ trunk/app.c Sat Apr 15 17:53:53 2006
@@ -414,7 +414,7 @@
 		if (filename[0] == '/') 
 			ast_copy_string(tmpf, filename, sizeof(tmpf));
 		else
-			snprintf(tmpf, sizeof(tmpf), "%s/%s/%s", (char *)ast_config_AST_VAR_DIR, "sounds", filename);
+			snprintf(tmpf, sizeof(tmpf), "%s/%s/%s", (char *)ast_config_AST_DATA_DIR, "sounds", filename);
 		fd = open(tmpf, O_RDONLY);
 		if (fd < 0){
 			ast_log(LOG_WARNING, "Unable to open file '%s': %s\n", tmpf, strerror(errno));

Modified: trunk/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/asterisk.c?rev=20330&r1=20329&r2=20330&view=diff
==============================================================================
--- trunk/asterisk.c (original)
+++ trunk/asterisk.c Sat Apr 15 17:53:53 2006
@@ -206,6 +206,7 @@
 char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_VAR_DIR[AST_CONFIG_MAX_PATH];
+char ast_config_AST_DATA_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_LOG_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_AGI_DIR[AST_CONFIG_MAX_PATH];
 char ast_config_AST_DB[AST_CONFIG_MAX_PATH];
@@ -2081,6 +2082,7 @@
 	ast_copy_string(ast_config_AST_MODULE_DIR, AST_MODULE_DIR, sizeof(ast_config_AST_MODULE_DIR));
  	snprintf(ast_config_AST_MONITOR_DIR, sizeof(ast_config_AST_MONITOR_DIR) - 1, "%s/monitor", ast_config_AST_SPOOL_DIR);
 	ast_copy_string(ast_config_AST_VAR_DIR, AST_VAR_DIR, sizeof(ast_config_AST_VAR_DIR));
+	ast_copy_string(ast_config_AST_DATA_DIR, AST_DATA_DIR, sizeof(ast_config_AST_DATA_DIR));
 	ast_copy_string(ast_config_AST_LOG_DIR, AST_LOG_DIR, sizeof(ast_config_AST_LOG_DIR));
 	ast_copy_string(ast_config_AST_AGI_DIR, AST_AGI_DIR, sizeof(ast_config_AST_AGI_DIR));
 	ast_copy_string(ast_config_AST_DB, AST_DB, sizeof(ast_config_AST_DB));
@@ -2117,6 +2119,8 @@
 			ast_copy_string(ast_config_AST_VAR_DIR, v->value, sizeof(ast_config_AST_VAR_DIR));
 			snprintf(ast_config_AST_DB, sizeof(ast_config_AST_DB), "%s/astdb", v->value);
 			snprintf(ast_config_AST_KEY_DIR, sizeof(ast_config_AST_KEY_DIR), "%s/keys", v->value);
+		} else if (!strcasecmp(v->name, "astdatadir")) {
+			ast_copy_string(ast_config_AST_DATA_DIR, v->value, sizeof(ast_config_AST_DATA_DIR));
 		} 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")) {

Modified: trunk/build_tools/make_defaults_h
URL: http://svn.digium.com/view/asterisk/trunk/build_tools/make_defaults_h?rev=20330&r1=20329&r2=20330&view=diff
==============================================================================
--- trunk/build_tools/make_defaults_h (original)
+++ trunk/build_tools/make_defaults_h Sat Apr 15 17:53:53 2006
@@ -11,6 +11,7 @@
 #define AST_MODULE_DIR "${INSTALL_PATH}${MODULES_DIR}"
 #define AST_SPOOL_DIR  "${INSTALL_PATH}${ASTSPOOLDIR}"
 #define AST_VAR_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}"
+#define AST_DATA_DIR   "${INSTALL_PATH}${ASTDATADIR}"
 #define AST_LOG_DIR    "${INSTALL_PATH}${ASTLOGDIR}"
 #define AST_AGI_DIR    "${INSTALL_PATH}${AGI_DIR}"
 #define AST_KEY_DIR    "${INSTALL_PATH}${ASTVARLIBDIR}/keys"
@@ -19,7 +20,7 @@
 
 #define AST_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
 
-#define AST_SOUNDS     "${INSTALL_PATH}${ASTVARLIBDIR}/sounds"
-#define AST_IMAGES     "${INSTALL_PATH}${ASTVARLIBDIR}/images"
+#define AST_SOUNDS     "${INSTALL_PATH}${ASTDATADIR}/sounds"
+#define AST_IMAGES     "${INSTALL_PATH}${ASTDATADIR}/images"
 
 END

Modified: trunk/file.c
URL: http://svn.digium.com/view/asterisk/trunk/file.c?rev=20330&r1=20329&r2=20330&view=diff
==============================================================================
--- trunk/file.c (original)
+++ trunk/file.c Sat Apr 15 17:53:53 2006
@@ -261,7 +261,7 @@
 		asprintf(&fn, "%s.%s", filename, ext);
 	else
 		asprintf(&fn, "%s/sounds/%s.%s",
-			ast_config_AST_VAR_DIR, filename, ext);
+			ast_config_AST_DATA_DIR, filename, ext);
 	return fn;
 }
 

Modified: trunk/http.c
URL: http://svn.digium.com/view/asterisk/trunk/http.c?rev=20330&r1=20329&r2=20330&view=diff
==============================================================================
--- trunk/http.c (original)
+++ trunk/http.c Sat Apr 15 17:53:53 2006
@@ -125,12 +125,12 @@
 	mtype=ftype2mtype(ftype, wkspace, sizeof(wkspace));
 	
 	/* Cap maximum length */
-	len = strlen(uri) + strlen(ast_config_AST_VAR_DIR) + strlen("/static-http/") + 5;
+	len = strlen(uri) + strlen(ast_config_AST_DATA_DIR) + strlen("/static-http/") + 5;
 	if (len > 1024)
 		goto out403;
 		
 	path = alloca(len);
-	sprintf(path, "%s/static-http/%s", ast_config_AST_VAR_DIR, uri);
+	sprintf(path, "%s/static-http/%s", ast_config_AST_DATA_DIR, uri);
 	if (stat(path, &st))
 		goto out404;
 	if (S_ISDIR(st.st_mode))

Modified: trunk/image.c
URL: http://svn.digium.com/view/asterisk/trunk/image.c?rev=20330&r1=20329&r2=20330&view=diff
==============================================================================
--- trunk/image.c (original)
+++ trunk/image.c Sat Apr 15 17:53:53 2006
@@ -103,9 +103,9 @@
 			snprintf(buf, len, "%s.%s", filename, ext);
 	} else {
 		if (!ast_strlen_zero(preflang))
-			snprintf(buf, len, "%s/%s/%s-%s.%s", ast_config_AST_VAR_DIR, "images", filename, preflang, ext);
+			snprintf(buf, len, "%s/%s/%s-%s.%s", ast_config_AST_DATA_DIR, "images", filename, preflang, ext);
 		else
-			snprintf(buf, len, "%s/%s/%s.%s", ast_config_AST_VAR_DIR, "images", filename, ext);
+			snprintf(buf, len, "%s/%s/%s.%s", ast_config_AST_DATA_DIR, "images", filename, ext);
 	}
 }
 

Modified: trunk/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk.h?rev=20330&r1=20329&r2=20330&view=diff
==============================================================================
--- trunk/include/asterisk.h (original)
+++ trunk/include/asterisk.h Sat Apr 15 17:53:53 2006
@@ -34,6 +34,7 @@
 extern char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_VAR_DIR[AST_CONFIG_MAX_PATH];
+extern char ast_config_AST_DATA_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_LOG_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_AGI_DIR[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_DB[AST_CONFIG_MAX_PATH];

Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?rev=20330&r1=20329&r2=20330&view=diff
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Sat Apr 15 17:53:53 2006
@@ -281,6 +281,7 @@
 		setenv("AST_SPOOL_DIR", ast_config_AST_SPOOL_DIR, 1);
 		setenv("AST_MONITOR_DIR", ast_config_AST_MONITOR_DIR, 1);
 		setenv("AST_VAR_DIR", ast_config_AST_VAR_DIR, 1);
+		setenv("AST_DATA_DIR", ast_config_AST_DATA_DIR, 1);
 		setenv("AST_LOG_DIR", ast_config_AST_LOG_DIR, 1);
 		setenv("AST_AGI_DIR", ast_config_AST_AGI_DIR, 1);
 		setenv("AST_KEY_DIR", ast_config_AST_KEY_DIR, 1);



More information about the asterisk-commits mailing list