|
@@ -21,27 +21,38 @@ namespace MediaBrowser.ServerApplication.Updates
|
|
|
version = File.ReadAllText(archive + ".ver");
|
|
|
}
|
|
|
|
|
|
+ var systemPath = appPaths.ProgramSystemPath;
|
|
|
+ var tempPath = Path.GetTempPath();
|
|
|
+
|
|
|
// Use our installer passing it the specific archive
|
|
|
// We need to copy to a temp directory and execute it there
|
|
|
- var source = Path.Combine(appPaths.ProgramSystemPath, UpdaterExe);
|
|
|
+ var source = Path.Combine(systemPath, UpdaterExe);
|
|
|
|
|
|
logger.Info("Copying updater to temporary location");
|
|
|
- var tempUpdater = Path.Combine(Path.GetTempPath(), UpdaterExe);
|
|
|
+ var tempUpdater = Path.Combine(tempPath, UpdaterExe);
|
|
|
File.Copy(source, tempUpdater, true);
|
|
|
- source = Path.Combine(appPaths.ProgramSystemPath, UpdaterDll);
|
|
|
- var tempUpdaterDll = Path.Combine(Path.GetTempPath(), UpdaterDll);
|
|
|
+ source = Path.Combine(systemPath, UpdaterDll);
|
|
|
+ var tempUpdaterDll = Path.Combine(tempPath, UpdaterDll);
|
|
|
|
|
|
logger.Info("Copying updater dependencies to temporary location");
|
|
|
File.Copy(source, tempUpdaterDll, true);
|
|
|
- const string product = "server";
|
|
|
+ var product = "server";
|
|
|
// Our updater needs SS and ionic
|
|
|
- source = Path.Combine(appPaths.ProgramSystemPath, "ServiceStack.Text.dll");
|
|
|
- File.Copy(source, Path.Combine(Path.GetTempPath(), "ServiceStack.Text.dll"), true);
|
|
|
- source = Path.Combine(appPaths.ProgramSystemPath, "SharpCompress.dll");
|
|
|
- File.Copy(source, Path.Combine(Path.GetTempPath(), "SharpCompress.dll"), true);
|
|
|
+ source = Path.Combine(systemPath, "ServiceStack.Text.dll");
|
|
|
+ File.Copy(source, Path.Combine(tempPath, "ServiceStack.Text.dll"), true);
|
|
|
+ source = Path.Combine(systemPath, "SharpCompress.dll");
|
|
|
+ File.Copy(source, Path.Combine(tempPath, "SharpCompress.dll"), true);
|
|
|
|
|
|
logger.Info("Starting updater process.");
|
|
|
- Process.Start(tempUpdater, string.Format("product={0} archive=\"{1}\" caller={2} pismo=false version={3} service={4} installpath=\"{5}\"", product, archive, Process.GetCurrentProcess().Id, version, restartServiceName ?? string.Empty, appPaths.ProgramDataPath));
|
|
|
+
|
|
|
+ // installpath = program data folder
|
|
|
+ // startpath = executable to launch
|
|
|
+ // systempath = folder containing installation
|
|
|
+ var args = string.Format("product={0} archive=\"{1}\" caller={2} pismo=false version={3} service={4} installpath=\"{5}\" startpath=\"{6}\" systempath=\"{7}\"",
|
|
|
+ product, archive, Process.GetCurrentProcess().Id, version, restartServiceName ?? string.Empty, appPaths.ProgramDataPath, appPaths.ApplicationPath, systemPath);
|
|
|
+
|
|
|
+ logger.Info("Args: {0}", args);
|
|
|
+ Process.Start(tempUpdater, args);
|
|
|
|
|
|
// That's it. The installer will do the work once we exit
|
|
|
}
|