示例#1
0
function installFMModule($module_name, $proto, $compress, $data, $server_location, $url)
{
    global $argv;
    extract($server_location);
    echo fM('  --> Detecting firewall...');
    $app = detectFWVersion(true);
    if ($app === null) {
        echo "failed\n\n";
        echo fM("Cannot find a supported firewall - please check the README document for supported firewalls.  Aborting.\n");
        exit(1);
    }
    extract($app);
    $data['server_type'] = $server['type'];
    if (versionCheck($app_version, $proto . '://' . $hostname . '/' . $path, $compress) == true) {
        echo 'ok (' . $server['type'] . ")\n";
    } else {
        echo "failed\n\n";
        echo $server['type'] . ' ' . $app_version . " is not supported.\n";
        exit(1);
    }
    $data['server_version'] = $app_version;
    $data['server_interfaces'] = implode(';', getInterfaceNames(PHP_OS));
    echo fM("\n  --> Detection complete.  Continuing installation.\n\n");
    /** Handle the update method */
    $data['server_update_method'] = processUpdateMethod($module_name, $update_method, $data, $url);
    $raw_data = getPostData(str_replace('genserial', 'addserial', $url), $data);
    $raw_data = $data['compress'] ? @unserialize(gzuncompress($raw_data)) : @unserialize($raw_data);
    return $data;
}
示例#2
0
function installFMModule($module_name, $proto, $compress, $data, $server_location, $url)
{
    global $argv;
    extract($server_location);
    echo fM('  --> Detecting firewall...');
    $app = detectFWVersion(true);
    if ($app === null) {
        echo "failed\n\n";
        echo fM("Cannot find a supported firewall - please check the README document for supported firewalls.  Aborting.\n");
        exit(1);
    }
    extract($app);
    $data['server_type'] = $server['type'];
    if (versionCheck($app_version, $proto . '://' . $hostname . '/' . $path, $compress) == true) {
        echo 'ok (' . $server['type'] . ")\n";
    } else {
        echo "failed\n\n";
        echo $server['type'] . ' ' . $app_version . " is not supported.\n";
        exit(1);
    }
    $data['server_version'] = $app_version;
    $data['server_interfaces'] = implode(';', getInterfaceNames(PHP_OS));
    echo fM("\n  --> Detection complete.  Continuing installation.\n\n");
    /** Update via cron or http/s? */
    $update_choices = array('c', 's', 'h');
    while (!isset($update_method)) {
        echo fM('Will ' . $data['server_name'] . ' get updates via cron, ssh, or http(s) [c|s|h]? ');
        $update_method = trim(strtolower(fgets(STDIN)));
        /** Must be a valid option */
        if (!in_array($update_method, $update_choices)) {
            unset($update_method);
        }
    }
    /** Handle the update method */
    $data['server_update_method'] = processUpdateMethod($module_name, $update_method, $data, $url);
    $raw_data = getPostData(str_replace('genserial', 'addserial', $url), $data);
    $raw_data = $data['compress'] ? @unserialize(gzuncompress($raw_data)) : @unserialize($raw_data);
    return $data;
}