From d6de5e5958148a8d957a3418b42857f9fc7367de Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Wed, 23 Dec 2015 10:31:11 +1100 Subject: [PATCH] Add TempPath parameter to bootstrapper install Allows a temporary path to be passed to the Bootstrapper to be used when mounting WIM images during the offline install phase. Allows mounting to be done on another (faster, SSD) volume. --- Disco.ClientBootstrapper/InstallLoop.cs | 9 ++++----- .../Interop/InstallInterop.cs | 20 ++++++++----------- Disco.ClientBootstrapper/Program.cs | 8 +++++--- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Disco.ClientBootstrapper/InstallLoop.cs b/Disco.ClientBootstrapper/InstallLoop.cs index e0482724..36a9a798 100644 --- a/Disco.ClientBootstrapper/InstallLoop.cs +++ b/Disco.ClientBootstrapper/InstallLoop.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading; namespace Disco.ClientBootstrapper @@ -14,11 +11,13 @@ namespace Disco.ClientBootstrapper private CompleteCallback mCompleteCallback; private string InstallLocation; private string WimImageId; + private string TempPath; - public InstallLoop(string InstallLocation, string WimImageId = null) + public InstallLoop(string InstallLocation, string WimImageId, string TempPath) { this.InstallLocation = InstallLocation; this.WimImageId = WimImageId; + this.TempPath = TempPath; } public void Start(CompleteCallback Callback) @@ -34,7 +33,7 @@ namespace Disco.ClientBootstrapper //Program.Status.UpdateStatus(null, null, "Testing UI"); //Program.SleepThread(5000, false); - Interop.InstallInterop.Install(this.InstallLocation, this.WimImageId); + Interop.InstallInterop.Install(this.InstallLocation, this.WimImageId, this.TempPath); if (this.mCompleteCallback != null) { this.mCompleteCallback.BeginInvoke(null, null); diff --git a/Disco.ClientBootstrapper/Interop/InstallInterop.cs b/Disco.ClientBootstrapper/Interop/InstallInterop.cs index 279d03d9..5f18a46b 100644 --- a/Disco.ClientBootstrapper/Interop/InstallInterop.cs +++ b/Disco.ClientBootstrapper/Interop/InstallInterop.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.Diagnostics; -using System.Runtime.InteropServices; -using Microsoft.Win32; +using Microsoft.Win32; +using System; using System.IO; -using System.Threading; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; namespace Disco.ClientBootstrapper.Interop { @@ -187,7 +183,7 @@ namespace Disco.ClientBootstrapper.Interop #endregion } - public static void Install(string InstallLocation, string WimImageId = null) + public static void Install(string InstallLocation, string WimImageId, string TempPath) { Program.Status.UpdateStatus("Installing Bootstrapper", "Starting", "Please wait...", false); @@ -234,12 +230,12 @@ namespace Disco.ClientBootstrapper.Interop } // Get Temp Path - var wimMountPath = Path.Combine(Path.GetTempPath(), "DiscoClientBootstrapperWimMount"); + var wimMountPath = Path.Combine(TempPath ?? Path.GetTempPath(), "DiscoClientBootstrapperWimMount"); if (Directory.Exists(wimMountPath)) Directory.Delete(wimMountPath, true); Directory.CreateDirectory(wimMountPath); - var wimTempMountPath = Path.Combine(Path.GetTempPath(), "DiscoClientBootstrapperWimTempMount"); + var wimTempMountPath = Path.Combine(TempPath ?? Path.GetTempPath(), "DiscoClientBootstrapperWimTempMount"); if (Directory.Exists(wimTempMountPath)) Directory.Delete(wimTempMountPath, true); Directory.CreateDirectory(wimTempMountPath); diff --git a/Disco.ClientBootstrapper/Program.cs b/Disco.ClientBootstrapper/Program.cs index 34930959..77958c24 100644 --- a/Disco.ClientBootstrapper/Program.cs +++ b/Disco.ClientBootstrapper/Program.cs @@ -1,8 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; using System.Threading; +using System.Windows.Forms; namespace Disco.ClientBootstrapper { @@ -40,11 +39,14 @@ namespace Disco.ClientBootstrapper statusForm.Show(); string installLocation = null; string wimImage = null; + string tempPath = null; if (args.Length > 1) installLocation = args[1]; if (args.Length > 2) wimImage = args[2]; - InstallLoop = new InstallLoop(installLocation, wimImage); + if (args.Length > 3) + tempPath = args[3]; + InstallLoop = new InstallLoop(installLocation, wimImage, tempPath); InstallLoop.Start(new InstallLoop.CompleteCallback(InstallComplete)); Application.Run(); return;