Changeset 12357
- Timestamp:
- 08/04/11 17:30:20 (2 years ago)
- Files:
-
- freepbx/branches/2.9/amp_conf/bin/freepbx_engine (modified) (1 diff)
- freepbx/branches/2.9/amp_conf/bin/freepbx_setting (modified) (1 diff)
- freepbx/branches/2.9/install_amp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/branches/2.9/amp_conf/bin/freepbx_engine
r12230 r12357 160 160 chmod 640 /etc/amportal.conf 161 161 chmod 640 $FREEPBX_CONF 162 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTRUNDIR 163 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTETCDIR 164 chmod -R g+w $ASTETCDIR 165 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTVARLIBDIR 166 chmod g+w $ASTVARLIBDIR 167 chmod -R g+w $ASTVARLIBDIR/* 168 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTLOGDIR 169 chmod -R g+w $ASTLOGDIR 170 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTSPOOLDIR 171 chmod -R g+w $ASTSPOOLDIR 172 chown -R $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $AMPWEBROOT/admin 173 chmod -R g+w $AMPWEBROOT/admin 174 chown -R $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $FOPWEBROOT 175 chmod -R g+w $FOPWEBROOT 176 chown -R $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $AMPWEBROOT/recordings 177 chmod -R g+w $AMPWEBROOT/recordings 178 chown -R $AMPASTERISKWEBUSER:$AAMPASTERISKWEBGROUP $AMPWEBROOT/_asterisk 179 chmod u+x,g+x $AMPBIN/* 180 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $AMPBIN/* 162 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $(readlink -f $ASTRUNDIR) 163 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $(readlink -f $ASTETCDIR) 164 chmod -R g+w $(readlink -f $ASTETCDIR) 165 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $(readlink -f $ASTVARLIBDIR) 166 chmod -R g+w $(readlink -f $ASTVARLIBDIR) 167 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $(readlink -f $ASTLOGDIR) 168 chmod -R g+w $(readlink -f $ASTLOGDIR) 169 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $(readlink -f $ASTSPOOLDIR) 170 chmod -R g+w $(readlink -f $ASTSPOOLDIR) 171 chown -R $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $(readlink -f $AMPWEBROOT/admin) 172 chmod -R g+w $(readlink -f $AMPWEBROOT/admin) 173 chown -R $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $(readlink -f $FOPWEBROOT) 174 chmod -R g+w $(readlink -f $FOPWEBROOT) 175 chown -R $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $(readlink -f $AMPWEBROOT/recordings) 176 chmod -R g+w $(readlink -f $AMPWEBROOT/recordings) 177 chown -R $AMPASTERISKWEBUSER:$AAMPASTERISKWEBGROUP $(readlink -f $AMPWEBROOT/_asterisk) 178 chmod u+x,g+x $(readlink -f $AMPBIN)/* 179 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $(readlink -f $AMPBIN) 181 180 182 181 if [ "$FPBXDBUGFILE" != "" -a -e "$FPBXDBUGFILE" ]; then 183 chown $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $ FPBXDBUGFILE182 chown $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $(readlink -f $FPBXDBUGFILE) 184 183 fi 185 184 186 185 if [ "$FPBX_LOG_FILE" != "" -a -e "$FPBX_LOG_FILE" ]; then 187 chown $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $ FPBX_LOG_FILE186 chown $AMPASTERISKWEBUSER:$AMPASTERISKWEBGROUP $(readlink -f $FPBX_LOG_FILE) 188 187 fi 189 188 190 189 if [ "$ASTAGIDIR" != "" ]; then 191 190 chmod u+x $ASTAGIDIR/* 192 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ ASTAGIDIR191 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $(readlink -f $ASTAGIDIR) 193 192 else 194 chmod u+x $ ASTVARLIBDIR/agi-bin/*193 chmod u+x $(readlink -f $ASTVARLIBDIR/agi-bin) 195 194 fi 196 195 freepbx/branches/2.9/amp_conf/bin/freepbx_setting
r11535 r12357 47 47 $user = trim(`whoami`); 48 48 $sudo_command = trim(getenv('SUDO_COMMAND')); 49 if ($user == 'root' && $sudo_command == '') { 50 $web_user = $freepbx_conf->get_conf_setting('AMPASTERISKWEBUSER'); 49 $web_user = $freepbx_conf->get_conf_setting('AMPASTERISKWEBUSER'); 50 exec("id $web_user 2>&1", $null, $retvar); 51 if ($web_user != "" && $retvar == 0 && $user == 'root' && $sudo_command == '') { 51 52 out(sprintf(_("trying to run as user %s:"),$web_user)); 52 53 out(''); freepbx/branches/2.9/install_amp
r12250 r12357 54 54 out(" --asteriskuser <user> Asterisk Manager username",false); 55 55 out(" --asteriskpass <pass> Asterisk Manager password",false); 56 out(" --systemconfig <path> System config files",false);57 56 out(" --debug Enable debug output",false); 58 57 out(" --dry-run Don't actually do anything",false); … … 69 68 out(" --my-svn-is-correct Ignore Asterisk version, assume it is correct",false); 70 69 out(" --engine <name> Use the specified PBX Engine ('asterisk')",false); 70 out(" --uid <user> Set ownership of files to user",false); 71 out(" --gid <group> Set ownership of files to group",false); 72 out(" --scripted Scripted install. Do not ask any questions.",false); 73 out(" (Intended for unattended installers only)",false); 71 74 } 72 75 … … 225 228 global $asterisk_user; 226 229 global $asterisk_pass; 230 global $scripted; 231 global $freepbxip; 232 global $runas_uid; 233 global $runas_gid; 227 234 228 235 out("Creating new $filename"); 229 236 237 if ($scripted == true) { 238 # Scripted install. Everything should have been set for us, don't ask questions. 239 out("Scripted install. Accepting command line params."); 240 $amp_conf["AMPDBUSER"] = $dbuser; 241 $amp_conf["AMPDBPASS"] = $dbpass; 242 $amp_conf["AMPDBHOST"] = $dbhost; 243 $amp_conf["AMPDBNAME"] = $dbname; 244 $amp_conf["AMPMGRUSER"] = "admin"; 245 $amp_conf["AMPMGRPASS"] = "unset"; 246 $amp_conf["AMPWEBROOT"] = $webroot; 247 $amp_conf["FOPWEBROOT"] = ($fopwebroot ? $fopwebroot : $webroot."/panel"); 248 $amp_conf["AMPWEBADDRESS"] = $freepbxip; 249 $amp_conf["FOPPASSWORD"] = "passw0rd"; 250 $amp_conf["AMPEXTENSIONS"] = "extensions"; 251 $amp_conf["AMPBIN"] = $ampbin_dir; 252 $amp_conf["AMPSBIN"] = "$ampsbin_dir"; 253 $amp_conf["AMPASTERISKWEBUSER"] = $runas_uid; 254 $amp_conf["AMPASTERISKWEBGROUP"] = $runas_gid; 255 $amp_conf["AMPASTERISKUSER"] = $runas_uid; 256 $amp_conf["AMPASTERISKGROUP"] = $runas_gid; 257 $amp_conf["AMPDEVUSER"] = $runas_uid; 258 $amp_conf["AMPDEVGROUP"] = $runas_gid; 259 write_amportal_conf($filename, $amp_conf); 260 outn(AMP_CONF." written"); 261 return; 262 } 263 230 264 outn("Enter your USERNAME to connect to the '$dbname' database:\n [".($dbuser ? $dbuser : $asterisk_user) . "] "); 231 265 $key = trim(fgets(STDIN,1024)); … … 283 317 $amp_conf["FOPWEBROOT"] = $fopwebroot; 284 318 285 outn("Enter the IP ADDRESS or hostname used to access the AMP web-admin:\n [ xx.xx.xx.xx] ");319 outn("Enter the IP ADDRESS or hostname used to access the AMP web-admin:\n [$freepbxip] "); 286 320 $key = trim(fgets(STDIN,1024)); 287 if (preg_match('/^$/',$key)) $amp_conf["AMPWEBADDRESS"] = "xx.xx.xx.xx";321 if (preg_match('/^$/',$key)) $amp_conf["AMPWEBADDRESS"] = $freepbxip; 288 322 else $amp_conf["AMPWEBADDRESS"] = $key; 289 323 … … 542 576 // **** Parse out command-line options 543 577 $shortopts = "h?u:p:"; 544 $longopts = array("help","debug","dry-run","username=","password=","force-version=","dbhost=","no-files","force-overwrite","dbname=","my-svn-is-correct","engine=","webroot=","install-moh","install-fop=","make-links-devel","dev-links","skip-module-install" );578 $longopts = array("help","debug","dry-run","username=","password=","force-version=","dbhost=","no-files","force-overwrite","dbname=","my-svn-is-correct","engine=","webroot=","install-moh","install-fop=","make-links-devel","dev-links","skip-module-install","uid=","gid=","scripted","freepbxip="); 545 579 546 580 $args = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), $shortopts, $longopts); … … 555 589 $install_files = true; 556 590 $override_astvers = false; 591 $scripted = false; 557 592 558 593 $install_moh = false; … … 563 598 //initialize variables to avoid php notices 564 599 $dbhost = null; 565 $dbname = null;600 $dbname = 'asterisk'; 566 601 $new_username = null; 567 602 $new_password = null; 603 604 $runas_uid = "asterisk"; 605 $runas_gid = "asterisk"; 606 $freepbxip = "192.168.1.1"; 568 607 569 608 foreach ($args[0] as $arg) { … … 654 693 case "--sbin": 655 694 $ampsbin_dir = $arg[1]; 656 out("Using sbin a r".$ampsbin_dir);695 out("Using sbin at ".$ampsbin_dir); 657 696 break; 658 697 case "--asteriskuser": … … 664 703 out("Using asteriskpass ".str_repeat("*",strlen($arg[1]))); 665 704 break; 666 667 /* do we need this ? 668 case "--systemconfig": 669 $systemconfig = $arg[1]; 670 out("Using system config at ". $systemconfig); 671 break; 672 */ 705 case "--uid": 706 $runas_uid = $arg[1]; 707 out("Setting ownership (user) to ".$runas_uid); 708 break; 709 case "--gid": 710 $runas_gid = $arg[1]; 711 out("Setting ownership (group) to ".$runas_gid); 712 break; 713 case "--scripted": 714 $scripted = true; 715 out("Unattended installation. No questions will be asked"); 716 break; 717 case "--freepbxip": 718 $freepbxip = $arg[1]; 719 out("Setting IP address of web interface to $freepbxip"); 720 break; 673 721 674 722 } … … 710 758 // this file contains password and should not be a+r 711 759 // this addresses http://freepbx.org/trac/ticket/1878 712 chown(AMP_CONF, "asterisk");713 chgrp(AMP_CONF, "asterisk");760 chown(AMP_CONF, $runas_uid); 761 chgrp(AMP_CONF, $runas_gid); 714 762 chmod(AMP_CONF, 0640); 715 763 716 collect_settings(AMP_CONF, $dbhost, $new_username, $new_password, 'asterisk');764 collect_settings(AMP_CONF, $dbhost, $new_username, $new_password, $dbname); 717 765 718 766 out("Assuming new install, --install-moh added to command line"); … … 1036 1084 } 1037 1085 1086 // Ensure executables are executable 1087 chmod($amp_conf["AMPBIN"]."/freepbx_setting", 0755); 1038 1088 outn("Configuring install for your environment.."); 1089 exec($amp_conf["AMPBIN"]."/freepbx_setting AMPASTERISKWEBGROUP $runas_gid"); 1090 exec($amp_conf["AMPBIN"]."/freepbx_setting AMPASTERISKWEBUSER $runas_uid"); 1091 exec($amp_conf["AMPBIN"]."/freepbx_setting AMPASTERISKGROUP $runas_gid"); 1092 exec($amp_conf["AMPBIN"]."/freepbx_setting AMPASTERISKUSER $runas_uid"); 1093 exec($amp_conf["AMPBIN"]."/freepbx_setting AMPDEVGROUP $runas_gid"); 1094 exec($amp_conf["AMPBIN"]."/freepbx_setting AMPDEVUSER $runas_uid"); 1039 1095 if (!$dryrun) { 1040 1096 $asteriskuser = isset($amp_conf['AMPASTERISKUSER']) && $amp_conf['AMPASTERISKUSER'] ? $amp_conf['AMPASTERISKUSER'] : 'asterisk';
