function cse($haystack, $needle, $insensitive = 1) { # Char Search End return char_search_end($haystack, $needle, $insensitive); }
public function copyKernelModules() { $mountpoint = $this->mount_this_guy(); $kernev = trim(`uname -r`); if (!lxfile_exists("{$mountpoint}/lib/modules/{$kernev}")) { lxfile_cp_rec("/lib/modules/{$kernev}", "{$mountpoint}/lib/modules/{$kernev}"); } if (char_search_end($kernev, "-xen")) { $nkernev = strtil($kernev, "-xen"); if (!lxfile_exists("{$mountpoint}/lib/modules/{$nkernev}")) { lxfile_cp_rec("/lib/modules/{$kernev}", "{$mountpoint}/lib/modules/{$nkernev}"); } } if (char_search_beg($this->main->ostemplate, "centos-")) { if (lxfile_exists("{$mountpoint}/lib/tls")) { lxfile_rm_rec("{$mountpoint}/lib/tls.disabled"); lxfile_mv_rec("{$mountpoint}/lib/tls", "{$mountpoint}/lib/tls.disabled"); } } }
public function copyKernelModules() { /* * For Xen we may have few different situation here: * 1. RHEL5 with pygrub template -> do nothing, follow pygrub procedure (skip copying of kernel modules) * 2. RHEL5 without pygrub template -> copy existing kernel modules * 3. RHEL6 with pygrub template -> same as for RHEL5 * 4. RHEL6 without pygrub template -> check below: * 4a. if RHEL-5/CentOS-5 or old kloxo (hostinabox) -> copy lxkernel-domU-xen kernel modules * 4b. if other modern linux -> copy existing kernel modules * */ $pygrub_record = explode('-', $this->main->ostemplate); if (!stripos($pygrub_record[3], 'pygrub') !== FALSE) { $mountpoint = $this->mount_this_guy(); if (is_centosfive()) { $kernev = trim(`uname -r`); } else { if (char_search_beg($this->main->ostemplate, "centos-5")) { $kernev = trim(`rpm -q --queryformat '%{VERSION}-%{RELEASE}' lxkernel-domU-xen`); $kernev .= 'xen'; } else { $kernev = trim(`uname -r`); } } if (!lxfile_exists("{$mountpoint}/lib/modules/{$kernev}")) { lxfile_cp_rec("/lib/modules/{$kernev}", "{$mountpoint}/lib/modules/{$kernev}"); } if (char_search_end($kernev, "-xen")) { $nkernev = strtil($kernev, "-xen"); if (!lxfile_exists("{$mountpoint}/lib/modules/{$nkernev}")) { lxfile_cp_rec("/lib/modules/{$kernev}", "{$mountpoint}/lib/modules/{$nkernev}"); } } if (char_search_beg($this->main->ostemplate, "centos-")) { if (lxfile_exists("{$mountpoint}/lib/tls")) { lxfile_rm_rec("{$mountpoint}/lib/tls.disabled"); lxfile_mv_rec("{$mountpoint}/lib/tls", "{$mountpoint}/lib/tls.disabled"); } } } }