Ejemplo n.º 1
0
        }
    }
    exit(0);
}
if (isset($options['setup'])) {
    if (is_link($directory)) {
        freepbx::out("Confused. {$directory} is a symbolic link. Please resolve then run this again");
        exit(1);
    }
    if (empty($vars['username'])) {
        $username = freepbx::getInput("FreePBX Username");
    } else {
        $username = $vars['username'];
    }
    if (empty($vars['password'])) {
        $password = freepbx::getPassword("FreePBX Password", true);
    } else {
        $password = $vars['password'];
    }
    try {
        $freepbx = new freepbx($username, $password);
    } catch (Exception $e) {
        freepbx::out("Invalid Username/Password Combination");
        exit(1);
    }
    if (isset($options['keys'])) {
        $pkeys = explode(",", $options['keys']);
    } else {
        $pkeys = array("freepbx");
    }
    $force = isset($options['force']) ? true : false;
Ejemplo n.º 2
0
 $repo = Git::open($repodir);
 $moduleMasterXmlString = $repo->show('origin/master', 'module.xml');
 $masterXML = simplexml_load_string($moduleMasterXmlString);
 try {
     $moduleBranchXmlString = $repo->show('origin/release/' . $options['updatemaster'], 'module.xml');
     $branchXML = simplexml_load_string($moduleBranchXmlString);
 } catch (\Exception $e) {
     die($e->getMessage());
 }
 $rawname = (string) $branchXML->rawname;
 $name = (string) $branchXML->name;
 $description = (string) $branchXML->description;
 if (empty($vars['githubtoken'])) {
     freepbx::out("If you add 'githubtoken' to your .freepbxconfig file you wont have to enter these credentials");
     $username = freepbx::getInput("GitHub Username");
     $password = freepbx::getPassword("GitHub Password", true);
     $client = new \Github\Client();
     $client->authenticate($username, $password, Github\Client::AUTH_HTTP_PASSWORD);
 } else {
     $client = new \Github\Client();
     $client->authenticate($vars['githubtoken'], "", Github\Client::AUTH_HTTP_TOKEN);
 }
 $merge = true;
 if (!freepbx::version_compare_freepbx((string) $masterXML->supported->version, (string) $branchXML->supported->version, "<=")) {
     echo "Master is on a higher or equal supported version than " . $options['updatemaster'] . "\n";
     $merge = false;
 }
 if (freepbx::version_compare_freepbx((string) $masterXML->version, (string) $branchXML->version, ">")) {
     echo "Master is a higher (" . (string) $masterXML->version . ") version than this release (" . (string) $branchXML->version . ")? Scary? Aborting\n";
     $merge = false;
 }
Ejemplo n.º 3
0
 $publish = freepbx::getInput('Publish?', 'n');
 if ($publish == 'y' || $publish == 'yes') {
     if (function_exists('ssh2_connect')) {
         foreach ($final_status as $module => $status) {
             $supported = freepbx::getInput('Supported Version to Publish for?', $supported['version']);
             $connection = ssh2_connect('mirror1.freepbx.org');
             $fingerprint = ssh2_fingerprint($connection, SSH2_FINGERPRINT_MD5 | SSH2_FINGERPRINT_HEX);
             if (strcmp("B5CA3DA1C15FA48CC70746EE7BCEACA5", $fingerprint) !== 0) {
                 freepbx::out("Unable to verify server identity!");
                 exit(1);
             }
             $user = posix_getpwuid(posix_geteuid());
             $username = freepbx::getInput('Username?', $user['name']);
             $ssh_auth_pub = $username == 'root' ? '/root/.ssh/id_rsa.pub' : '/home/' . $username . '/.ssh/id_rsa.pub';
             $ssh_auth_priv = $username == 'root' ? '/root/.ssh/id_rsa' : '/home/' . $username . '/.ssh/id_rsa';
             $ssh_auth_pass = !file_exists($ssh_auth_pub) || !file_exists($ssh_auth_priv) ? freepbx::getPassword("Password?") : null;
             if (!ssh2_auth_pubkey_file($connection, $username, $ssh_auth_pub, $ssh_auth_priv, $ssh_auth_pass)) {
                 freepbx::out('Autentication rejected by server');
                 exit(1);
             }
             $packager = "/usr/src/freepbx-server-dev-tools/server_packaging.php";
             if (!($stream = ssh2_exec($connection, "ls " . $packager))) {
                 freepbx::out('SSH command failed');
                 exit(1);
             }
             stream_set_blocking($stream, true);
             $data = "";
             while ($buf = fread($stream, 4096)) {
                 $data .= $buf;
             }
             fclose($stream);