Пример #1
0
function updateApplicableToSlaveToo()
{
    global $gbl, $sgbl, $login, $ghtml, $osversion;
    print "Download 3rdparty\n";
    // Fixes #303 and #304
    download_thirdparty();
    print "Installing binaries\n";
    lxfile_cp("__path_program_root/cexe/lxxen", "/usr/bin");
    lxfile_cp("__path_program_root/cexe/lxopenvz", "/usr/bin");
    print "Fixing binaries permissions\n";
    lxfile_generic_chmod("/usr/bin/lxopenvz", "6755");
    lxfile_generic_chmod("/usr/bin/lxxen", "6755");
    print "Install missing rpm packages if any";
    install_if_package_not_exist("rrdtool");
    print "-rrdtool-";
    install_if_package_not_exist("ntfsprogs");
    print "-ntfsprogs-";
    install_if_package_not_exist("parted");
    print "-parted-";
    install_if_package_not_exist("kpartx");
    print "-kpartx-";
    install_if_package_not_exist("dhcp");
    print "-dhcp-";
    install_if_package_not_exist("openssl");
    print "-openssl-";
    install_if_package_not_exist("openssl-devel");
    print "-openssl-devel-\n";
    system("chkconfig dhcpd on");
    print "Enable dhcpd at system startup\n";
    if (lxfile_exists("/etc/xen")) {
        lxfile_mkdir("/etc/xen/hypervm");
        if (!lxfile_exists("/boot/hypervm-xen-vmlinuz")) {
            system("cd /boot ; ln -sf vmlinuz-2.6-xen hypervm-xen-vmlinuz; ln -sf initrd-2.6-xen.img hypervm-xen-initrd.img");
        }
        $list = lscandir_without_dot("/etc/xen/auto");
        foreach ($list as $l) {
            $dir = strtil($l, ".cfg");
            lunlink("/etc/xen/auto/{$l}");
            if (lxfile_exists("/home/xen/{$dir}/{$l}")) {
                lxfile_symlink("/home/xen/{$dir}/{$l}", "/etc/xen/auto/{$l}");
            }
        }
    }
    if (lxfile_exists("/var/log/loadvg.log")) {
        lunlink("/var/log/loadvg.log");
    }
    if (lxfile_exists("/etc/vz")) {
        lxfile_cp("__path_program_root/file/sysfile/openvz/ve-vps.basic.conf-sample", "/etc/vz/conf");
        print "Set NEIGHBOUR_DEVS=all to vz.conf\n";
        vps__openvz::staticChangeConf("/etc/vz/vz.conf", "NEIGHBOUR_DEVS", "all");
    }
    print "Fixing openvz repo\n";
    // add openvz.repo
    lxfile_cp("../file/openvz.repo", "/etc/yum.repos.d/openvz.repo");
    print "Fixing lxcenter repo\n";
    // add lxcenter.repo
    $osversion = find_os_version();
    print "- Your OS {$osversion}\n";
    $cont = our_file_get_contents("../file/lxcenter.repo");
    $cont = str_replace("%distro%", $osversion, $cont);
    our_file_put_contents("/etc/yum.repos.d/lxcenter.repo", $cont);
    print "Fix RHN\n";
    fix_rhn_sources_file();
    print "Fix ipconntrack\n";
    fix_ipconntrack();
    if (lxfile_exists("/home/hypervm/xen/template")) {
        print "Check Xen windows-lxblank.img template\n";
        system("echo hypervm-windows > /home/hypervm/xen/template/windows-lxblank.img");
    }
    print "Fix memory graph\n";
    memoryGraphFix();
    print "Fix permission of closeallinput\n";
    lxfile_unix_chmod("../cexe/closeallinput", "0755");
    print "Fix LxEtc\n";
    installLxetc();
    print "Check binaries\n";
    system("cp ../sbin/lxrestart /usr/sbin/");
    system("chown root:root /usr/sbin/lxrestart");
    system("chmod 755 /usr/sbin/lxrestart");
    system("chmod ug+s /usr/sbin/lxrestart");
    system("chmod 777 /tmp");
    system("chmod o+t /tmp");
    print "Create script dir\n";
    copy_script();
    if (!lxfile_exists("/usr/local/lxlabs/kloxo/")) {
        print "Remove /usr/local/lxlabs/kloxo/ as it should not be here!\n";
        system("rmdir /usr/local/lxlabs/kloxo/httpdocs/ >/dev/null 2>&1");
        system("rmdir /usr/local/lxlabs/kloxo/ >/dev/null 2>&1");
    }
    if (!lxfile_exists("/var/named/chroot/etc/kloxo.named.conf")) {
        if (lxfile_exists("/var/named/chroot/etc/lxadmin.named.conf")) {
            remove_line("/var/named/chroot/etc/named.conf", "lxadmin.named.conf");
            $pattern = 'include "/etc/kloxo.named.conf";';
            $file = "/var/named/chroot/etc/named.conf";
            $comment = "//Kloxo";
            @addLineIfNotExistInside($file, $pattern, $comment);
            @lxfile_mv("/var/named/chroot/etc/lxadmin.named.conf", "/var/named/chroot/etc/kloxo.named.conf");
        }
    }
}
Пример #2
0
function updatecleanup()
{
    setPrepareKloxo();
    // Fixes #303 and #304
    installThirdparty();
    install_gd();
    install_bogofilter();
    setInitialPhpMyAdmin();
    setInitialAdminAccount();
    setInitialKloxoPhp();
    installWebmail();
    installAwstats();
    setRemoveOldDirs();
    setInitialBinary();
    log_cleanup("Remove lighttpd errorlog");
    log_cleanup("- Remove process");
    remove_lighttpd_error_log();
    log_cleanup("Fix the secure logfile");
    log_cleanup("- Fix process");
    call_with_flag("fix_secure_log");
    log_cleanup("Clean hosts.deny");
    log_cleanup("- Clean process");
    call_with_flag("remove_host_deny");
    log_cleanup("Turn off mouse daemon");
    log_cleanup("- Turn off process");
    system("chkconfig gpm off");
    if (lxfile_exists("phpinfo.php")) {
        log_cleanup("Remove phpinfo.php");
        log_cleanup("- Remove process");
        lxfile_rm("phpinfo.php");
    }
    setInitialBind();
    log_cleanup("Killing gettraffic system process");
    log_cleanup("- Killing process");
    lxshell_return("pkill", "-f", "gettraffic");
    setCheckPackages();
    copy_script();
    install_xcache();
    log_cleanup("Install Kloxo service");
    log_cleanup("- Install process");
    lxfile_unix_chmod("/etc/init.d/kloxo", "0755");
    system("chkconfig kloxo on");
    setJailshellSystem();
    log_cleanup("Set /home permission to 0755");
    log_cleanup("- Set process");
    lxfile_unix_chmod("/home", "0755");
    setExecuteCentos5Script();
    fix_rhn_sources_file();
    setInitialApacheConfig();
    setInitialPureftpConfig();
    setInstallMailserver();
    log_cleanup("Enable xinetd service");
    log_cleanup("- Enable process");
    call_with_flag("enable_xinetd");
    fix_suexec();
    if (!lxfile_exists("/usr/bin/php-cgi")) {
        log_cleanup("Initialize php-cgi binary");
        log_cleanup("- Initialize process");
        lxfile_cp("/usr/bin/php", "/usr/bin/php-cgi");
    }
    setSomePermissions();
    setInitialLighttpdConfig();
    setInitialNobodyScript();
    setSomeScript();
    log_cleanup("Install /etc/init.d/djbdns service file");
    log_cleanup("- Install process");
    lxfile_cp("../file/djbdns.init", "/etc/init.d/djbdns");
    removeOtherDrivers();
    log_cleanup("Remove cache dir");
    log_cleanup("- Remove process");
    lxfile_rm_rec("__path_program_root/cache");
    log_cleanup("Restart syslog service");
    log_cleanup("- Restart process");
    createRestartFile('syslog');
    log_cleanup("Initialize awstats dirdata");
    log_cleanup("- Initialize process");
    lxfile_mkdir("/home/kloxo/httpd/awstats/dirdata");
    setInitialLogrotate();
    installRoundCube();
    installHorde();
    installChooser();
    log_cleanup("Remove old lxlabs ssh key");
    log_cleanup("- Remove process");
    remove_ssh_self_host_key();
    setInitialServer();
    setDefaultPages();
    installInstallApp();
    setFreshClam();
    changeMailSoftlimit();
}