function updatecleanup_main() { global $argc, $argv; global $gbl, $sgbl, $login, $ghtml; $program = $sgbl->__var_program_name; $opt = parse_opt($argv); if ($opt['type'] === 'master') { initProgram('admin'); $flg = "__path_program_start_vps_flag"; if (!lxfile_exists($flg)) { set_login_skin_to_feather(); } } else { $login = new Client(null, null, 'update'); } print "Executing UpdateCleanup. This can take a long time. Please be patient\n"; log_log("update", "Executing Updatecleanup"); // // Cleanup old lxlabs.repo file // print "Fixing Repo's\n"; if (lxfile_exists("/etc/yum.repos.d/lxcenter.repo")) { if (lxfile_exists("/etc/yum.repos.d/lxlabs.repo")) { lxfile_mv("/etc/yum.repos.d/lxlabs.repo", "/etc/yum.repos.d/lxlabs.repo.lxsave"); system("rm -f /etc/yum.repos.d/lxlabs.repo"); } } if (lxfile_exists("CVS")) { print "Found Development version, we just go on.\n"; // exit; } if ($opt['type'] === 'master') { $sgbl->slave = false; if (!is_secondary_master()) { print "Update database\n"; updateDatabaseProperly(); print "Fix Extra database issues\n"; fixExtraDB(); print "Update extra issues\n"; doUpdateExtraStuff(); print "Get Driver info\n"; lxshell_return("__path_php_path", "../bin/common/driverload.php"); } print "Starting Update all slaves\n"; update_all_slave(); print "Fix main {$program} databasefile\n"; cp_dbfile(); } else { $sgbl->slave = true; } if (!is_secondary_master()) { print "Starting update cleanups\n"; updatecleanup(); } lxfile_touch("__path_program_start_vps_flag"); }
function doUpdateExtraStuff() { global $gbl, $sgbl, $login, $ghtml; lxfile_mkdir("__path_program_etc/flag"); convertIpaddressToComa(); print "Fix extra database\n"; fixExtraDB(); print "Set some defaults\n"; db_set_default('vps', 'ttype', 'openvz'); db_set_default('pserver', 'coma_psrole_a', 'vps'); db_set_default("vps", "swapdiskname", "vm.swap", "ttype = 'xen'"); db_set_default("vps", "maindiskname", "root.img", "ttype = 'xen'"); db_set_default('vps', 'corerootdir', '/vz/private', "ttype = 'openvz'"); db_set_default("vps", "corerootdir", "/home/xen", "ttype = 'xen'"); print "Fixing database passwords\n"; $a = null; fix_mysql_root_password('localhost'); $dbadmin = new Dbadmin(null, 'localhost', "mysql___localhost"); $dbadmin->get(); $pass = $dbadmin->dbpassword; $a['mysql']['dbpassword'] = $pass; slave_save_db("dbadmin", $a); print "Fixing OS template permissions\n"; lxfile_unix_chmod_rec("/vz/template/cache/", "0755"); lxfile_unix_chmod_rec("/home/hypervm/xen/template/", "0755"); call_with_flag("dofixParentClname"); print "Check License\n"; passthru("{$sgbl->__path_php_path} htmllib/lbin/getlicense.php"); print "Fix OpenVZ resources\n"; fixOpenVZResource(); print "Move clients to client of needed\n"; move_clients_to_client(); print "create backup dirs\n"; add_vps_backup_dir(); print "Parse SQL Data\n"; parse_sql_data(); print "Fix IP POOL\n"; lxshell_return("__path_php_path", "../bin/fix/fixippool.php"); print "Fix IP adresses in database\n"; fix_ipaddress_column_type(); fix_vmipaddress(); print "Checking HIB template\n"; get_kloxo_ostemplate(); print "Set admin email\n"; save_admin_email(); print "Checking Skin Images\n"; copy_image(); system("mysql -u hypervm -p`cat ../etc/conf/hypervm.pass` hypervm1_0 < ../file/interface/interface_template.dump"); if (lxfile_exists("/etc/init.d/libvirtd")) { print "Make sure libvirtd is not started after reboot\n"; system("chkconfig libvirtd off 2>/dev/null"); } if (is_openvz()) { print "Fixing Base OS templates\n"; if (!lxfile_real("/vz/template/cache/centos-5-i386-afull.tar.gz")) { system("mkdir -p /vz/template/cache/ ; cd /vz/template/cache/ ; rm centos-5-i386-afull.tar.gz; wget download.lxcenter.org/download/openvztemplates/base/centos-5-i386-afull.tar.gz "); system("rm /vz/template/cache/index.html* 2>/dev/null"); } } else { if (!lxfile_real("/home/hypervm/xen/template/centos-5-i386-afull.tar.gz")) { system("mkdir -p /home/hypervm/xen/template ; cd /home/hypervm/xen/template/ ; rm centos-5-i386-afull.tar.gz; wget download.lxcenter.org/download/xentemplates/base/centos-5-i386-afull.tar.gz "); system("rm /home/hypervm/xen/template/index.html* 2>/dev/null"); } } print "Fix SSL\n"; fix_self_ssl(); print "Fix database password\n"; critical_change_db_pass(); print "Delete old repo's\n"; if (lxfile_exists("/etc/yum.repos.d/lxlabs.repo")) { lxfile_mv("/etc/yum.repos.d/lxlabs.repo", "/etc/yum.repos.d/lxlabs.repo.lxsave"); system("rm -f /etc/yum.repos.d/lxlabs.repo"); print "Removed lxlabs.repo\n"; } }
<?php include_once "htmllib/lib/include.php"; include_once "lib/updatelib.php"; if (!lxfile_exists("__path_slave_db")) { updateDatabaseProperly(); fixExtraDB(); }