check getuid function available in stallater before calling as Blackfin doesn't suppo...
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 7 Mar 2008 22:39:22 +0000 (22:39 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 7 Mar 2008 22:39:22 +0000 (22:39 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@9 01035d8c-6547-0410-b346-abe4f91aad63

freepbx-sandbox/Makefile
freepbx-sandbox/patch/freepbx.patch

index 345c644cbc428eef644a2b42724936156749533d..589fcd8f5ac9a78a7ad5de12c52df5d0fa6e7038 100644 (file)
@@ -378,14 +378,6 @@ freepbx-make-patch:
        $(AROOT)/admin/cdr/lib/Class.Table.php \
        >> patch/freepbx.patch
 
-       # support for Blackfin machine type in conf array, helps install_amp switch
-       # off a few unsupported function calls
-
-       -diff -uN \
-       $(AO)/amp_conf/htdocs/admin/functions.inc.php \
-       $(A)/amp_conf/htdocs/admin/functions.inc.php \
-       >> patch/freepbx.patch
-
        # typo in newinstall.sqlite3.sql
 
        -diff -uN \
@@ -393,7 +385,7 @@ freepbx-make-patch:
        $(A)/SQL/newinstall.sqlite3.sql \
        >> patch/freepbx.patch
 
-       # stop installer warnings when sqlite3 used
+       # stop installer warning/errors when sqlite3 and blackfin used
 
        -diff -uN \
        $(AO)/install_amp \
index b75a5955b1b6fcac2ff695142f2b752be524a4c0..ce0de80f2be25b08de7c60511054e40af0b92ae2 100644 (file)
                $num = $res -> numRows();
                
                
---- freepbx-2.4.0-orig//amp_conf/htdocs/admin/functions.inc.php        2008-02-09 02:12:18.000000000 +1030
-+++ freepbx-2.4.0//amp_conf/htdocs/admin/functions.inc.php     2008-03-07 18:20:40.000000000 +1030
-@@ -32,6 +32,7 @@
-       'AMPMGRPASS'     => array('std' , 'amp111'),
-       'FOPPASSWORD'    => array('std' , 'passw0rd'),
-       'FOPSORT'        => array('std' , 'extension'),
-+      'AMPMACHINE'     => array('std' , 'x86'),
-       'ASTETCDIR'      => array('dir' , '/etc/asterisk'),
-       'ASTMODDIR'      => array('dir' , '/usr/lib/asterisk/modules'),
 --- freepbx-2.4.0-orig//SQL/newinstall.sqlite3.sql     2008-02-11 14:27:53.000000000 +1030
 +++ freepbx-2.4.0//SQL/newinstall.sqlite3.sql  2008-03-02 20:20:33.000000000 +1030
 @@ -323,7 +323,7 @@
        `id` varchar(20) NOT NULL default 'xml',
        `time` int(11) NOT NULL default '0',
 --- freepbx-2.4.0-orig//install_amp    2008-01-28 04:22:58.000000000 +1030
-+++ freepbx-2.4.0//install_amp 2008-03-07 18:24:30.000000000 +1030
++++ freepbx-2.4.0//install_amp 2008-03-07 19:18:46.000000000 +1030
 @@ -4,7 +4,7 @@
  require_once ("libfreepbx.install.php");
  
  define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf");
  define("UPGRADE_DIR", dirname(__FILE__)."/upgrades");
  define("MODULE_DIR", dirname(__FILE__)."/amp_conf/htdocs/admin/modules/");
-@@ -691,13 +691,20 @@
+@@ -691,13 +691,16 @@
  // **** Look for user = root
  
  outn("Checking user..");
 -if ($current_user != "root"){
 -      out("FAILED");
 -      fatal($argv[0]." must be run as root");
-+if ($amp_conf["AMPMACHINE"] != "Blackfin") {
-+
-+      # Blackfin doesn't support posix_getuid() but we are always root anyway
-+
++if (function_exists('posix_getpwuid') && functionIexists('posix_geteuid') {
 +      //$current_user=(isset($_ENV["USER"]) ? $_ENV["USER"] : exec('whoami',$output));
 +      $euid = (posix_getpwuid(posix_geteuid()));
 +      $current_user = $euid['name'];
 +              out("FAILED");
 +              fatal($argv[0]." must be run as root");
 +      }
-+
  }
 +
  out("OK");
  
  
-@@ -892,10 +899,12 @@
+@@ -892,10 +895,12 @@
  
  outn("Connecting to database..");