OSDN Git Service

na-get-lib,exeのインストーラもパッケージリストの<SilentInstallArguments>要素を指定することでサイレントインストールできるようにした。
authorttp <ttp@users.sourceforge.jp>
Thu, 3 Jul 2008 11:21:45 +0000 (11:21 +0000)
committerttp <ttp@users.sourceforge.jp>
Thu, 3 Jul 2008 11:21:45 +0000 (11:21 +0000)
git-svn-id: http://localhost/svn/AppliStation/trunk@931 34ed2c89-c49f-4a4b-abdb-c318350108cf

na-get-lib/NaGet.Packages.Install/Installation.cs
na-get-lib/NaGet.Packages/Package.cs
na-get-lib/NaGet.SubCommands/NaGetInstall.cs

index 229b428..869b481 100644 (file)
@@ -136,6 +136,8 @@ namespace NaGet.Packages.Install
                                        case InstallerType.ARCHIVE:\r
                                        case InstallerType.MSI_PACKAGE:\r
                                                return true;\r
+                                       case InstallerType.EXEC_INSTALLER:\r
+                                               return ! string.IsNullOrEmpty(InstalledPackage.SilentInstallArguments);\r
                                        default:\r
                                                return false;\r
                                }\r
@@ -214,7 +216,11 @@ namespace NaGet.Packages.Install
                        try {\r
                                switch (type) {\r
                                case InstallerType.EXEC_INSTALLER:\r
-                                       hProcess = Process.Start(installerfile);\r
+                                       if (Silent) {\r
+                                               hProcess = Process.Start(installerfile, InstalledPackage.SilentInstallArguments);\r
+                                       } else {\r
+                                               hProcess = Process.Start(installerfile);\r
+                                       }\r
                                        \r
                                        break;\r
                                case InstallerType.MSI_PACKAGE:\r
@@ -273,7 +279,6 @@ namespace NaGet.Packages.Install
                                }\r
                        }\r
                        \r
-                       \r
                        int exitCode = invokeInstaller(installerFile, InstalledPackage.Type);\r
                        \r
                        installed = true;\r
index ee12ee3..3cca05e 100644 (file)
@@ -69,7 +69,7 @@ namespace NaGet.Packages
                /// </summary>\r
                public InstallerType Type;\r
                \r
-                               /// <summary>\r
+               /// <summary>\r
                /// インストーラが書庫内に入っているかのフラグ\r
                /// </summary>\r
                public bool ArchivedInstaller = false;\r
@@ -80,6 +80,13 @@ namespace NaGet.Packages
                public string UninstallerKey;\r
                \r
                /// <summary>\r
+               /// サイレントインストールのための引数。\r
+               /// インストーラ形式のみ有効で、nullもしくは空文字列の場合は\r
+               /// サイレントインストールができないことをあらわす\r
+               /// </summary>\r
+               public string SilentInstallArguments;\r
+               \r
+               /// <summary>\r
                /// インストールスクリプト(MSBuildドキュメント)\r
                /// </summary>\r
                public string InstallScript;\r
index 0e5dd72..e000ff7 100644 (file)
@@ -118,9 +118,15 @@ namespace NaGet.SubCommands
                        }\r
                        \r
                        foreach (Installation inst in Installations) {\r
-                               RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED_TASKSET, inst.ToString());\r
+                               string installTaskMsg = inst.ToString();\r
+                               if (inst.Silent && (!inst.SupportsSilentOnly)) {\r
+                                       installTaskMsg += " (\83T\83C\83\8c\83\93\83g\83C\83\93\83X\83g\81[\83\8b)";\r
+                               }\r
+                               \r
+                               RaiseTaskSetEvent(NaGetTaskSetEventType.STARTED_TASKSET, installTaskMsg);\r
                                \r
                                try {\r
+                                       \r
                                        inst.ErrorDataReceived += this.ReceivedErrorData;\r
                                        inst.OutputDataReceived += this.ReceivedOutputData;\r
                                        int exitCode = inst.Install();\r
@@ -136,7 +142,7 @@ namespace NaGet.SubCommands
                                }\r
                                currentTaskSetIndex ++;\r
                                \r
-                               RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, inst.ToString());\r
+                               RaiseTaskSetEvent(NaGetTaskSetEventType.COMPLETED_TASKSET, installTaskMsg);\r
                                \r
                                if (cancelCalled) {\r
                                        RaiseTaskSetEvent(NaGetTaskSetEventType.CANCELED, "\83p\83b\83P\81[\83W\82Ì\83C\83\93\83X\83g\81[\83\8b\8f\88\97\9d\82ª\83L\83\83\83\93\83Z\83\8b\82³\82ê\82Ü\82µ\82½");\r