// the directory path is based on Virtio driver version 0.1-59 (Apr 2013) static private void InstallVirtIODrivers(string baseDir) { if (!Directory.Exists(baseDir)) { throw new Exception(string.Format("Can't find the driver directory ({0})", baseDir)); } OSEnvironment.Enum_OsName osName = OSEnvironment.OS_Name; bool is64bit = OSEnvironment.Is64bit; // resolve OS string virtioDir = baseDir; if (osName == OSEnvironment.Enum_OsName.XP) { virtioDir += "\\WXP"; // there's no AMD64 directory ==> should check against 64bit XP } else if (osName == OSEnvironment.Enum_OsName.S2003 || osName == OSEnvironment.Enum_OsName.S2003R2) { virtioDir += "\\WNET"; } else if (osName == OSEnvironment.Enum_OsName.Vista || osName == OSEnvironment.Enum_OsName.S2008) { virtioDir += "\\WLH"; } else if (osName == OSEnvironment.Enum_OsName.Win7 || osName == OSEnvironment.Enum_OsName.S2008R2) { virtioDir += "\\WIN7"; } else if (osName == OSEnvironment.Enum_OsName.Win8 || osName == OSEnvironment.Enum_OsName.S2012) { virtioDir += "\\WIN8"; } else { throw new Exception("OS type can't be determined"); } // resolve 64/32 bit if (is64bit) { virtioDir += "\\AMD64"; } else { virtioDir += "\\X86"; } if (!Directory.Exists(virtioDir)) { throw new Exception(string.Format("Can't find the VirtIO driver directory({0})", virtioDir)); } // this call may throw an exception if failed DriverManager.Instance.InstallDrivers(new string[] { virtioDir }); }
static void Main(string[] args) { _installLocation = EucaConstant.ProgramRoot; if (_installLocation == null) { Log("[FAILURE] Can't find the Eucalyptus install location while installing XenPV installer"); return; } string xenPVDir = string.Format("{0}\\xenpv", _installLocation); if (Directory.Exists(xenPVDir)) { OSEnvironment.Enum_OsName osName = OSEnvironment.OS_Name; if (osName == OSEnvironment.Enum_OsName.Vista || osName == OSEnvironment.Enum_OsName.Win7 || osName == OSEnvironment.Enum_OsName.S2008 || osName == OSEnvironment.Enum_OsName.S2008R2) { string msg = "XenPV installation may fail due to driver signing requirements. Please read admin manual if you encounter the problem."; // Log("OS is Vista or newer; warning message displayed"); // MessageBox.Show(msg, "WARNING"); } LaunchEucaPostInstaller(); } }
// this directory path is based on Virtio driver version 1.1.11-0 static private void InstallVirtIODrivers(string baseDir) { if (!Directory.Exists(baseDir)) { throw new Exception(string.Format("Can't find the driver directory ({0})", baseDir)); } /// determine O/S, 32/64bit /// OSEnvironment.Enum_OsName osName = OSEnvironment.OS_Name; bool is64bit = OSEnvironment.Is64bit; // first check NetKVM directory exists string netDir = baseDir + "\\NetKVM"; if (osName == OSEnvironment.Enum_OsName.XP || osName == OSEnvironment.Enum_OsName.S2003 || osName == OSEnvironment.Enum_OsName.S2003R2) { netDir += "\\XP"; } else if (osName == OSEnvironment.Enum_OsName.Vista || osName == OSEnvironment.Enum_OsName.S2008 || osName == OSEnvironment.Enum_OsName.Win7 || osName == OSEnvironment.Enum_OsName.S2008R2) { netDir += "\\Vista"; } else { throw new Exception("OS type can't be determined"); } if (is64bit) { netDir += "\\amd64"; } else { netDir += "\\x86"; } if (!Directory.Exists(netDir)) { throw new Exception(string.Format("Can't find the VirtIO Net driver directory({0})", netDir)); } string storDir = baseDir + "\\viostor"; if (osName == OSEnvironment.Enum_OsName.XP) { storDir += "\\WXp\\x86"; // there's no AMD64 directory ==> should check against 64bit XP } else if (osName == OSEnvironment.Enum_OsName.S2003 || osName == OSEnvironment.Enum_OsName.S2003R2) { storDir += "\\Wnet"; if (is64bit) { storDir += "\\amd64"; } else { storDir += "\\x86"; } } else if (osName == OSEnvironment.Enum_OsName.Vista || osName == OSEnvironment.Enum_OsName.S2008) { storDir += "\\Wlh"; if (is64bit) { storDir += "\\amd64"; } else { storDir += "\\x86"; } } else if (osName == OSEnvironment.Enum_OsName.Win7 || osName == OSEnvironment.Enum_OsName.S2008R2) { storDir += "\\win7"; if (is64bit) { storDir += "\\amd64"; } else { storDir += "\\x86"; } } else { throw new Exception("OS type can't be determined"); } if (!Directory.Exists(storDir)) { throw new Exception(string.Format("Can't find the VirtIO storage driver directory({0})", storDir)); } // this call may throw an exception if failed DriverManager.Instance.InstallDrivers(new string[] { netDir, storDir }); }
static private void InstallXenPVDrivers(string baseDir) { OSEnvironment.Enum_OsName osName = OSEnvironment.OS_Name; bool is64bit = OSEnvironment.Is64bit; string msiFile = null; if (osName == OSEnvironment.Enum_OsName.XP) { msiFile = baseDir + "\\" + GPLPV_XP_MSI; } else if (osName == OSEnvironment.Enum_OsName.S2003 || osName == OSEnvironment.Enum_OsName.S2003R2) { if (is64bit) { msiFile = baseDir + "\\" + GPLPV_S2003_64_MSI; } else { msiFile = baseDir + "\\" + GPLPV_S2003_32_MSI; } } else if (osName == OSEnvironment.Enum_OsName.Vista || osName == OSEnvironment.Enum_OsName.Win7 || osName == OSEnvironment.Enum_OsName.S2008 || osName == OSEnvironment.Enum_OsName.S2008R2) { if (is64bit) { msiFile = baseDir + "\\" + GPLPV_S2008_64_MSI; } else { msiFile = baseDir + "\\" + GPLPV_S2008_32_MSI; } } else { throw new Exception("OS type can't be determined"); } if (!File.Exists(msiFile)) { throw new Exception(string.Format("Can't find the file {0}", msiFile)); } using (System.Diagnostics.Process proc = new System.Diagnostics.Process()) { proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.FileName = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\msiexec.exe"; proc.StartInfo.Arguments = string.Format("/i \"{0}\"", msiFile); if (!File.Exists(proc.StartInfo.FileName)) { throw new Exception(string.Format("Can't find the exe file ({0})", proc.StartInfo.FileName)); } proc.Start(); proc.WaitForExit(); int exitCode = proc.ExitCode; if (!(exitCode == 0 || exitCode == 1602)) // complete or user canceled installation { throw new Exception(string.Format("XenPV installer returned exit code={0})", exitCode)); } } }