From 66498eee0b24cd58c92b1532d34bdad0f87addba Mon Sep 17 00:00:00 2001
From: Anthony Minessale II <anthmct@yahoo.com>
Date: Thu, 29 Apr 2004 19:55:46 +0000
Subject: [PATCH] update astxs utility to allow auto load/unload and url
 compile

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2822 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 contrib/scripts/astxs | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/contrib/scripts/astxs b/contrib/scripts/astxs
index 663617ecd5..3529f976c7 100755
--- a/contrib/scripts/astxs
+++ b/contrib/scripts/astxs
@@ -95,6 +95,27 @@ if($args{print}) {
 
 my($base,$ext);
 my $cfile = $args{plain}->[0];
+
+
+if($cfile =~ /http:\/\/.*?\/([^\/]+)$/) {
+
+  my $f = $1;
+  if(! -d "/tmp/astbld") {
+    mkdir("/tmp/astbld");
+  }
+  my $pwd = `pwd`;
+  chomp $pwd;
+  chdir("/tmp/astbld");
+  system("/bin/rm $f");
+  system("wget $cfile");
+  chdir($pwd);
+  $cfile = "/tmp/astbld/$f";
+
+
+}
+
+
+
 if($cfile) {
   ($base,$ext) = $cfile =~ /^([^\.]+)\.(.)/;
 }
@@ -109,6 +130,16 @@ $bad = esystem("$vars{CC} $vars{CFLAGS} -c ${base}.c -o ${base}.o");
 $bad = esystem("$vars{CC} $vars{SOLINK} -o $vars{LDFLAGS} ${base}.so $base.o $vars{EXTOBJ}") if(!$bad);
 
 if($args{install} and $vars{MODULES_DIR}) {
+  my $file = "${base}.so";
+  my ($mod) = $file =~ /([^\/]*)$/;
+
+  if($args{autoload}) {
+    $bad = esystem("/usr/sbin/asterisk -rx 'unload $mod'");
+  }
   $bad = esystem("/bin/cp -p ${base}.so $vars{MODULES_DIR}") if(!$bad);
+  
+  if($args{autoload}) {
+    $bad = esystem("/usr/sbin/asterisk -rx 'load $mod'");
+  }
 }
 
-- 
GitLab