提交 7c1a3203 authored 作者: Bret McDanel's avatar Bret McDanel

This will create a modules.conf.xml from the build modules.conf. Ideal for a…

This will create a modules.conf.xml from the build modules.conf.  Ideal for a new build to uncomment 
all modules you built and comment the ones you did not.



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/scripts/contrib@13142 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 3fb813a9
...@@ -23,6 +23,11 @@ with the programs whether commercial or FOSS. ...@@ -23,6 +23,11 @@ with the programs whether commercial or FOSS.
== FILE LIST == == FILE LIST ==
makemodconf.pl
This will create a modules.conf.xml from the build modules.conf
ideal for a new build to uncomment all modules you built and comment
the ones you did not
validate-ivr.pl validate-ivr.pl
Perl app that does not connect to FreeSWITCH[tm] in any way Perl app that does not connect to FreeSWITCH[tm] in any way
but will walk through the IVR xml. This lets you debug them but will walk through the IVR xml. This lets you debug them
......
#!/usr/bin/perl
# -*- mode:cperl; tab-width:4; c-basic-offset:4; c-indent-level:4; indent-tabs-mode:nil; -*-
# Copyright (C) 2009, Bret McDanel <trixter AT 0xdecafbad.com>
# I wanted an automated method to generate a modules.conf.xml based on the modules.conf
# that you build the code from. This is ideal for new builds but not very useful
# after that.
# to run:
# ./makemodconf.pl /usr/src/freeswitch/modules.conf > /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
# this is for modules that are not directly loaded by modules.conf.xml
my @exclude = (
'^mod_spidermonkey_.*$',
);
# this is for things that have odd directory locations
my %sectionfix = (
'../../libs/openzap' => 'endpoints'
);
my %modules = ();
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
sub is_excluded($)
{
my $modname = shift;
foreach my $regexp (@exclude) {
if($modname =~ /$regexp/) {
return 1;
}
}
return 0;
}
sub fix_section($)
{
my $section = shift;
if (exists $sectionfix{$section}) {
return $sectionfix{$section};
} else {
return $section;
}
}
if ($#ARGV != 0) {
print "Usage: $0 modules.conf\n";
exit;
}
my $infile = shift @ARGV;
open( INFILE, "< $infile" ) or die "Can't open $infile $!";
while( <INFILE> ) {
$_ = trim($_);
$_ =~ /^(#?)(.*)\/(.*)$/;
my $comment = $1;
my $section = fix_section($2);
my $modname = $3;
if(!is_excluded($modname)){
push (@{$modules{$section}},[$modname,$comment]);
}
}
print "<configuration name=\"modules.conf\" description=\"Modules\">\n";
print " <modules>\n";
foreach my $section (sort(keys %modules)) {
print "\n\t<!-- $section -->\n";
foreach (@{$modules{$section}}) {
my $comment = @$_[1];
my $modname = @$_[0];
if($comment eq "#") {
print "\t<!-- <load module=\"$modname\"/> -->\n";
} else {
print "\t<load module=\"$modname\"/>\n";
}
}
}
print " </modules>\n";
print "</configuration>\n";
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论