diff --git a/SparkleShare.sln b/SparkleShare.sln index 203f2813c..56aabe88a 100644 --- a/SparkleShare.sln +++ b/SparkleShare.sln @@ -1,6 +1,8 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31729.503 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sparkles", "Sparkles\Sparkles.csproj", "{2C914413-B31C-4362-93C7-1AE34F09112A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sparkles.Git", "Sparkles\Git\Sparkles.Git.csproj", "{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}" @@ -14,76 +16,113 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShare.Mac", "SparkleShare\Mac\SparkleShare.Mac.csproj", "{8FCDF699-E2C3-4CB3-AF98-44198972AFC0}" EndProject Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + SparkleShare\Common\SparkleShare.projitems*{728483aa-e34b-4441-bf2c-c8bc2901e4e0}*SharedItemsImports = 4 + SparkleShare\Common\SparkleShare.projitems*{8fcdf699-e2c3-4cb3-af98-44198972afc0}*SharedItemsImports = 4 + SparkleShare\Common\SparkleShare.projitems*{f16e3683-b622-4654-b799-99c8d68aa963}*SharedItemsImports = 13 + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution - Release|Any CPU = Release|Any CPU Debug|Any CPU = Debug|Any CPU + DebugMac|Any CPU = DebugMac|Any CPU + DebugWindows|Any CPU = DebugWindows|Any CPU + Release|Any CPU = Release|Any CPU ReleaseDist|Any CPU = ReleaseDist|Any CPU ReleaseMac|Any CPU = ReleaseMac|Any CPU - DebugMac|Any CPU = DebugMac|Any CPU + ReleaseWindows|Any CPU = ReleaseWindows|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.Build.0 = Release|Any CPU - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseDist|Any CPU.ActiveCfg = Release|Any CPU - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseDist|Any CPU.Build.0 = Release|Any CPU - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|Any CPU - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|Any CPU - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU - {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.DebugMac|Any CPU.Build.0 = DebugMac|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.DebugMac|Any CPU.Build.0 = DebugMac|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.DebugWindows|Any CPU.ActiveCfg = DebugWindows|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.DebugWindows|Any CPU.Build.0 = DebugWindows|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.ActiveCfg = Release|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.Build.0 = Release|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.ReleaseDist|Any CPU.ActiveCfg = Release|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.ReleaseDist|Any CPU.Build.0 = Release|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|Any CPU - {2C914413-B31C-4362-93C7-1AE34F09112A}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU - {2C914413-B31C-4362-93C7-1AE34F09112A}.DebugMac|Any CPU.Build.0 = DebugMac|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.ReleaseWindows|Any CPU.ActiveCfg = ReleaseWindows|Any CPU + {2C914413-B31C-4362-93C7-1AE34F09112A}.ReleaseWindows|Any CPU.Build.0 = ReleaseWindows|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.DebugMac|Any CPU.Build.0 = DebugMac|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.DebugWindows|Any CPU.ActiveCfg = DebugWindows|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.DebugWindows|Any CPU.Build.0 = DebugWindows|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.Build.0 = Release|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseDist|Any CPU.ActiveCfg = Release|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseDist|Any CPU.Build.0 = Release|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseWindows|Any CPU.ActiveCfg = ReleaseWindows|Any CPU + {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseWindows|Any CPU.Build.0 = ReleaseWindows|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.DebugWindows|Any CPU.ActiveCfg = DebugWindows|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.DebugWindows|Any CPU.Build.0 = DebugWindows|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.Build.0 = Release|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.ReleaseDist|Any CPU.ActiveCfg = Release|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.ReleaseWindows|Any CPU.ActiveCfg = ReleaseWindows|Any CPU + {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.ReleaseWindows|Any CPU.Build.0 = ReleaseWindows|Any CPU {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU + {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.DebugWindows|Any CPU.ActiveCfg = DebugMac|Any CPU {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.Release|Any CPU.ActiveCfg = Release|Any CPU {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.Release|Any CPU.Build.0 = Release|Any CPU {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.ReleaseDist|Any CPU.ActiveCfg = Release|Any CPU - {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.ReleaseDist|Any CPU.Build.0 = Release|Any CPU {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|Any CPU - {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU - {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.Build.0 = Release|Any CPU - {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.ReleaseDist|Any CPU.ActiveCfg = Release|Any CPU - {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.ReleaseDist|Any CPU.Build.0 = Release|Any CPU - {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|Any CPU - {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU - {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.Release|Any CPU.Build.0 = Release|Any CPU + {5714D3CA-88A6-4330-A29D-4CA90D1D193C}.ReleaseWindows|Any CPU.ActiveCfg = ReleaseMac|Any CPU {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU + {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.DebugMac|Any CPU.Build.0 = DebugMac|Any CPU + {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.DebugWindows|Any CPU.ActiveCfg = DebugMac|Any CPU + {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.Release|Any CPU.Build.0 = Release|Any CPU {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.ReleaseDist|Any CPU.ActiveCfg = ReleaseDist|Any CPU {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.ReleaseDist|Any CPU.Build.0 = ReleaseDist|Any CPU {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|Any CPU {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|Any CPU - {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU - {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.DebugMac|Any CPU.Build.0 = DebugMac|Any CPU + {8FCDF699-E2C3-4CB3-AF98-44198972AFC0}.ReleaseWindows|Any CPU.ActiveCfg = ReleaseMac|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7AC5D80F-C164-4892-9228-2AAF8C4B5FCE} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0 $0.DotNetNamingPolicy = $1 - $1.DirectoryNamespaceAssociation = None - $1.ResourceNamePolicy = FileFormatDefault $0.TextStylePolicy = $2 - $2.FileWidth = 120 - $2.inheritsSet = VisualStudio - $2.inheritsScope = text/plain $2.scope = text/plain + $2.TabsToSpaces = True $0.CSharpFormattingPolicy = $3 - $3.inheritsSet = Mono - $3.inheritsScope = text/x-csharp $3.scope = text/x-csharp + $3.IndentSwitchSection = False + $3.NewLinesForBracesInProperties = False + $3.NewLinesForBracesInAccessors = False + $3.NewLinesForBracesInAnonymousMethods = False + $3.NewLinesForBracesInControlBlocks = False + $3.NewLinesForBracesInAnonymousTypes = False + $3.NewLinesForBracesInObjectCollectionArrayInitializers = False + $3.NewLinesForBracesInLambdaExpressionBody = False + $3.NewLineForElse = False + $3.NewLineForCatch = False + $3.NewLineForFinally = False + $3.NewLineForMembersInObjectInit = False + $3.NewLineForMembersInAnonymousTypes = False + $3.NewLineForClausesInQuery = False + $3.SpacingAfterMethodDeclarationName = True + $3.SpaceAfterMethodCallName = True + $3.SpaceBeforeOpenSquareBracket = True version = EndGlobalSection EndGlobal - diff --git a/SparkleShare/Common/AboutController.cs b/SparkleShare/Common/AboutController.cs index 5095cb458..f943b0154 100644 --- a/SparkleShare/Common/AboutController.cs +++ b/SparkleShare/Common/AboutController.cs @@ -80,5 +80,5 @@ void CheckForNewVersion () UpdateLabelEvent ("Couldn’t check for updates\t"); } } - } + } } diff --git a/SparkleShare/Common/BaseController.cs b/SparkleShare/Common/BaseController.cs index 138142231..4353cc52b 100644 --- a/SparkleShare/Common/BaseController.cs +++ b/SparkleShare/Common/BaseController.cs @@ -224,6 +224,10 @@ public virtual void Initialize () Logger.LogInfo ("Environment", "SparkleShare " + version); Logger.LogInfo ("Environment", "Git LFS " + Sparkles.Git.GitCommand.GitLFSVersion); Logger.LogInfo ("Environment", "Git " + Sparkles.Git.GitCommand.GitVersion); + Logger.LogInfo ("Environment", "SSH " + Sparkles.SSHCommand.SSHVersion); + Logger.LogInfo ("Environment", "SSH-KeyGen " + Sparkles.SSHCommand.KeygenVersion); + Logger.LogInfo ("Environment", "SSH-KeyScan " + Sparkles.SSHCommand.KeyscanVersion); + Logger.LogInfo ("Environment", Sparkles.OpenSSLCommand.OpenSSLVersion); Logger.LogInfo ("Environment", InstallationInfo.OperatingSystem + " " + InstallationInfo.OperatingSystemVersion); UserAuthenticationInfo = new SSHAuthenticationInfo (); diff --git a/SparkleShare/Mac/Controller.cs b/SparkleShare/Mac/Controller.cs index db7510baf..fe4e7d52f 100644 --- a/SparkleShare/Mac/Controller.cs +++ b/SparkleShare/Mac/Controller.cs @@ -42,15 +42,7 @@ public Controller (Configuration config) { NSApplication.Init (); - GitCommand.GitPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core", "git"); - GitCommand.ExecPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core"); - - bool overwite = true; - - File.Copy ( - Path.Combine (GitCommand.ExecPath, "git-lfs"), - Path.Combine (Config.BinPath, "git-lfs"), - overwite); + Command.SetSearchPath(Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core")); NSWorkspace.Notifications.ObserveDidWake((object sender, NSNotificationEventArgs e) => { Console.Write ("Detected wake from sleep, checking for updates\n"); diff --git a/SparkleShare/Windows/README.md b/SparkleShare/Windows/README.md index c85784e1a..71f85cba9 100644 --- a/SparkleShare/Windows/README.md +++ b/SparkleShare/Windows/README.md @@ -4,10 +4,8 @@ You can choose to build SparkleShare from source or to run the Windows installer ### Installing build requirements -Install version 4.0 of the [.NET Framework](http://www.microsoft.com/download/en/details.aspx?id=17851) if you haven't already. - -Install [msysGit](https://github.com/msysgit/msysgit/releases) and copy the contents of the install folder -(`C:\Program Files (x86)\Git` by default) to `C:\path\to\SparkleShare-sources\bin\msysgit\` (create the "bin"-folder in the SparkleShare source directory). +Install [VisualStudioCommunity](https://visualstudio.microsoft.com/de/vs/community/) +or install version 4.0 of the [.NET Framework](http://www.microsoft.com/download/en/details.aspx?id=17851) if you haven't already. Open a command prompt and execute the following: @@ -16,13 +14,12 @@ cd C:\path\to\SparkleShare-sources cd SparkleShare\Windows build ``` - +The build command ends with 2 errors. But that´s all right. `C:\path\to\SparkleShare-sources\bin` should now contain `SparkleShare.exe`, which you can run. ### Creating a Windows installer - -To create an installer package, install [WiX 3.7](http://wix.codeplex.com/releases/view/99514), restart Windows and run: +To create an installer package, install [WiX 3.11.2](https://github.com/wixtoolset/wix3/releases/tag/wix3112rtm), restart Windows and run: ``` cd C:\path\to\SparkleShare-sources\SparkleShare\Windows\ @@ -40,4 +37,3 @@ Remove `My Documents\SparkleShare` and `AppData\Roaming\org.sparkleshare.Sparkle ### Uninstalling You can uninstall SparkleShare through the Windows Control Panel. - diff --git a/SparkleShare/Windows/SparkleShare.Windows.csproj b/SparkleShare/Windows/SparkleShare.Windows.csproj index 56e3d0d30..3596f15d6 100644 --- a/SparkleShare/Windows/SparkleShare.Windows.csproj +++ b/SparkleShare/Windows/SparkleShare.Windows.csproj @@ -37,17 +37,17 @@ pdbonly true - ..\..\bin + .\bin prompt 4 AllRules.ruleset - x86 + AnyCPU TRACE true false - ..\..\bin\ + .\bin\ TRACE;DEBUG prompt full @@ -56,18 +56,9 @@ false false - - true - ..\..\bin\ - TRACE;DEBUG - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - true - ..\..\bin\ + .\bin TRACE true pdbonly @@ -75,18 +66,9 @@ prompt AllRules.ruleset - - ..\..\bin\ - TRACE;DEBUG - prompt - full - true - 4 - false - true - ..\..\bin\ + .\bin TRACE;DEBUG full AnyCPU @@ -94,42 +76,18 @@ MinimumRecommendedRules.ruleset true + + ..\..\bin\ + TRACE;DEBUG + prompt + full + true + 4 + false + - - ..\..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.dll - - - ..\..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.MsDelta.dll - - - ..\..\packages\DeltaCompressionDotNet.1.0.0\lib\net45\DeltaCompressionDotNet.PatchApi.dll - - - ..\..\packages\squirrel.windows.1.5.2\lib\Net45\ICSharpCode.SharpZipLib.dll - - - ..\..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll - - - ..\..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll - - - ..\..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll - - - ..\..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll - - - ..\..\packages\squirrel.windows.1.5.2\lib\Net45\NuGet.Squirrel.dll - - - ..\..\packages\Splat.1.6.2\lib\Net45\Splat.dll - - - ..\..\packages\squirrel.windows.1.5.2\lib\Net45\Squirrel.dll - @@ -211,23 +169,23 @@ Images\user-icon-default.png Always - + Images\document-added-12.png Always - + Images\document-deleted-12.png Always - + Images\document-edited-12.png Always - + Images\document-moved-12.png Always - + Images\process-working-22.png Always @@ -266,7 +224,6 @@ Always - @@ -326,4 +283,7 @@ Sparkles.Git - \ No newline at end of file + + "$(ProjectDir)\postBuild.cmd" "$(TargetDir)git_scm" + + diff --git a/SparkleShare/Windows/SparkleShare.wxs b/SparkleShare/Windows/SparkleShare.wxs index 09a6deb42..63ab853ce 100644 --- a/SparkleShare/Windows/SparkleShare.wxs +++ b/SparkleShare/Windows/SparkleShare.wxs @@ -14,20 +14,15 @@ - - - - + - - - - - + + + @@ -40,30 +35,38 @@ - - - - - - + - - - + + + - + @@ -73,10 +76,9 @@ - + - diff --git a/SparkleShare/Windows/UserInterface/Controller.cs b/SparkleShare/Windows/UserInterface/Controller.cs index 7ba2f3bba..d7bf0f3c9 100644 --- a/SparkleShare/Windows/UserInterface/Controller.cs +++ b/SparkleShare/Windows/UserInterface/Controller.cs @@ -47,17 +47,13 @@ public override string PresetsPath public override void Initialize () { - // Add msysgit to path, as we cannot asume it is added to the path - // Asume it is installed in @"\msysgit\bin" - string executable_path = Path.GetDirectoryName (Forms.Application.ExecutablePath); - string msysgit_path = Path.Combine (executable_path, "msysgit"); - + string[] search_path = new string[] { Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),"git_scm","mingw64", "bin"), + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),"git_scm","mingw32", "bin"), + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),"git_scm","usr","bin"), + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),"git_scm","cmd")}; + Command.SetSearchPath(search_path); Environment.SetEnvironmentVariable ("HOME", Environment.GetFolderPath (Environment.SpecialFolder.UserProfile)); - SSHCommand.SSHPath = Path.Combine (msysgit_path, "usr", "bin"); - SSHFetcher.SSHKeyScan = Path.Combine (msysgit_path, "usr", "bin", "ssh-keyscan.exe"); - GitCommand.GitPath = Path.Combine (msysgit_path, "bin", "git.exe"); - base.Initialize (); } @@ -89,28 +85,31 @@ public override void SetFolderIcon () string app_path = Path.GetDirectoryName (Forms.Application.ExecutablePath); string icon_file_path = Path.Combine (app_path, "Images", "sparkleshare-folder.ico"); - if (!File.Exists (icon_file_path)) + if (File.Exists (icon_file_path)) { string ini_file_path = Path.Combine (FoldersPath, "desktop.ini"); - string n = Environment.NewLine; - - string ini_file = "[.ShellClassInfo]" + n + - "IconFile=" + icon_file_path + n + - "IconIndex=0" + n + - "InfoTip=SparkleShare"; - - try - { - File.Create (ini_file_path).Close (); - File.WriteAllText (ini_file_path, ini_file); - - File.SetAttributes (ini_file_path, - File.GetAttributes (ini_file_path) | FileAttributes.Hidden | FileAttributes.System); - - } - catch (IOException e) + if (!File.Exists(ini_file_path)) { - Logger.LogInfo ("Config", "Failed setting icon for '" + FoldersPath + "': " + e.Message); + string n = Environment.NewLine; + + string ini_file = "[.ShellClassInfo]" + n + + "IconFile=" + icon_file_path + n + + "IconIndex=0" + n + + "InfoTip=SparkleShare"; + + try + { + File.Create(ini_file_path).Close(); + File.WriteAllText(ini_file_path, ini_file); + + File.SetAttributes(ini_file_path, + File.GetAttributes(ini_file_path) | FileAttributes.Hidden | FileAttributes.System); + + } + catch (IOException e) + { + Logger.LogInfo("Config", "Failed setting icon for '" + FoldersPath + "': " + e.Message); + } } } } @@ -129,7 +128,7 @@ public override void CreateStartupItem () Shortcut shortcut = new Shortcut (); shortcut.Create (shortcut_path, shortcut_target); } - + public override void InstallProtocolHandler () { @@ -184,16 +183,16 @@ public override void CopyToClipboard (string text) { try { Clipboard.SetData (DataFormats.Text, text); - + } catch (COMException e) { Logger.LogInfo ("Controller", "Copy to clipboard failed", e); } } - public override void Quit () + public override void PlatformQuit () { - base.Quit (); + System.Environment.Exit(0); } } } diff --git a/SparkleShare/Windows/UserInterface/EventLog.cs b/SparkleShare/Windows/UserInterface/EventLog.cs index 735648b16..bf8bc6a97 100644 --- a/SparkleShare/Windows/UserInterface/EventLog.cs +++ b/SparkleShare/Windows/UserInterface/EventLog.cs @@ -219,10 +219,12 @@ private void CreateEventLog () { browserGrid.Children.Add(sizingControlHeight); browserGrid.Children.Add(sizingControlWidth); - webbrowser.SetBinding(HeightProperty, new Binding("ActualHeightProperty") { ElementName = sizingControlHeight.Name }); - webbrowser.SetBinding(WidthProperty, new Binding("ActualWidthProperty") { ElementName = sizingControlWidth.Name }); + webbrowser.SetBinding(HeightProperty, new Binding("ActualHeightProperty").ElementName = sizingControlHeight.Name ); + webbrowser.SetBinding(WidthProperty, new Binding("ActualWidthProperty").ElementName = sizingControlWidth.Name ); grid_Base.Children.Add(border); + grid_Base.Children.Add(browserGrid); + Content = grid_Base; } private void OnClosing(object sender, CancelEventArgs cancel_event_args) diff --git a/SparkleShare/Windows/UserInterface/Setup.cs b/SparkleShare/Windows/UserInterface/Setup.cs index d6b523cd4..ca0d245bb 100644 --- a/SparkleShare/Windows/UserInterface/Setup.cs +++ b/SparkleShare/Windows/UserInterface/Setup.cs @@ -17,6 +17,7 @@ using Sparkles; using System; +using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; @@ -549,6 +550,83 @@ public Setup () break; } + case PageType.StorageSetup: + { + Header = string.Format("Storage type for ‘{0}’", Controller.SyncingFolder); + Description = "What type of storage would you like to use?"; + + //GroupBox layout_vertical = new GroupBox(); + var layout_radio_buttons = new List(); + int position = 100; + foreach (StorageTypeInfo storage_type in SparkleShare.Controller.FetcherAvailableStorageTypes) + { + TextBlock tb = new TextBlock(); + tb.TextWrapping = TextWrapping.Wrap; + //tb.Margin = new Thickness(10); + //tb.Inlines.Add("An example on "); + tb.Inlines.Add(new Run(storage_type.Name) { FontWeight = FontWeights.Bold }); + tb.Inlines.Add("\n"); + tb.Inlines.Add(storage_type.Description); + + RadioButton radio_button = new RadioButton() + { + Content = tb//storage_type.Name + "\n" + storage_type.Description + }; + layout_radio_buttons.Add(radio_button); + ContentCanvas.Children.Add(radio_button); + Canvas.SetLeft(radio_button, 195); + Canvas.SetTop(radio_button, position); + position += 100; + //radio_button.Text = storage_type.Name + "\n" + storage_type.Description; + /* + (radio_button.Child as Label).Markup = string.Format( + "{0}\n{2}", + storage_type.Name, 0, storage_type.Description); + + (radio_button.Child as Label).Xpad = 9;*/ + + //layout_radio_buttons.AddChild(radio_button); + //.PackStart(radio_button, false, false, 9); + /* radio_button.Group = (layout_radio_buttons.Children[0] as RadioButton).Group;*/ + }; + /* + layout_vertical.PackStart(new Label(""), true, true, 0); + layout_vertical.PackStart(layout_radio_buttons, false, false, 0); + layout_vertical.PackStart(new Label(""), true, true, 0); + Add(layout_vertical);*/ + + Button cancel_button = new Button() + { + Content = "Cancel" + }; + + Button continue_button = new Button() + { + Content = "Continue" + }; + continue_button.Click += delegate { + int checkbox_index = 0; + foreach (RadioButton radio_button in layout_radio_buttons) + { + if (radio_button.IsChecked==true) + { + StorageTypeInfo selected_storage_type = SparkleShare.Controller.FetcherAvailableStorageTypes[checkbox_index]; + Controller.StoragePageCompleted(selected_storage_type.Type); + return; + } + + checkbox_index++; + } + }; + + cancel_button.Click += delegate { + Controller.SyncingCancelled(); + }; + + Buttons.Add(cancel_button); + Buttons.Add(continue_button); + break; + } case PageType.CryptoSetup: { // TODO: Merge crypto pages diff --git a/SparkleShare/Windows/build.cmd b/SparkleShare/Windows/build.cmd index 2cae645b9..afae00644 100644 --- a/SparkleShare/Windows/build.cmd +++ b/SparkleShare/Windows/build.cmd @@ -1,28 +1,30 @@ -@echo off +@echo on set WinDirNet=%WinDir%\Microsoft.NET\Framework set msbuild="%WinDirNet%\v4.0\msbuild.exe" if not exist %msbuild% set msbuild="%WinDirNet%\v4.0.30319\msbuild.exe" +set WIX=C:\Program Files (x86)\WiX Toolset v3.11 set wixBinDir=%WIX%\bin +set OutputDir=%~dp0bin +if not exist "%OutputDir%" mkdir "%OutputDir%" -if not exist ..\..\bin mkdir ..\..\bin -copy Images\sparkleshare-app.ico ..\..\bin\ - -%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" "%~dp0\SparkleShare.sln" +%msbuild% "%~dp0..\..\SparkleShare.sln" /target:SparkleShare_Windows:Rebuild /p:Configuration=ReleaseWindows /p:Platform="Any CPU" -m if "%1"=="installer" ( if exist "%wixBinDir%" ( if exist "%~dp0\SparkleShare.msi" del "%~dp0\SparkleShare.msi" - "%wixBinDir%\heat.exe" dir "%~dp0\..\..\bin\msysgit" -cg msysGitComponentGroup -gg -scom -sreg -sfrag -srd -dr MSYSGIT_DIR -var wix.msysgitpath -o msysgit.wxs - "%wixBinDir%\heat.exe" dir "%~dp0\..\..\bin\plugins" -cg pluginsComponentGroup -gg -scom -sreg -sfrag -srd -dr PLUGINS_DIR -var wix.pluginsdir -o plugins.wxs - "%wixBinDir%\candle" "%~dp0\SparkleShare.wxs" -ext WixUIExtension -ext WixUtilExtension - "%wixBinDir%\candle" "%~dp0\msysgit.wxs" -ext WixUIExtension -ext WixUtilExtension - "%wixBinDir%\candle" "%~dp0\plugins.wxs" -ext WixUIExtension -ext WixUtilExtension - "%wixBinDir%\light" -ext WixUIExtension -ext WixUtilExtension Sparkleshare.wixobj msysgit.wixobj plugins.wixobj -droot="%~dp0\..\.." -dmsysgitpath="%~dp0\..\..\bin\msysgit" -dpluginsdir="%~dp0\..\..\bin\plugins" -o SparkleShare.msi + "%wixBinDir%\heat.exe" dir "%OutputDir%\git_scm" -cg gitScmComponentGroup -gg -scom -sreg -sfrag -srd -dr GITSCM_DIR -var wix.gitscmpath -o "%~dp0\git_scm.wxs" + "%wixBinDir%\heat.exe" dir "%OutputDir%\Images" -cg ImagesComponentGroup -gg -scom -sreg -sfrag -srd -dr IMAGES_DIR -var wix.imagespath -o "%~dp0\images.wxs" + "%wixBinDir%\heat.exe" dir "%OutputDir%\Presets" -cg PresetsComponentGroup -gg -scom -sreg -sfrag -srd -dr PRESETS_DIR -var wix.presetspath -o "%~dp0\presets.wxs" + "%wixBinDir%\candle" "%~dp0\SparkleShare.wxs" -ext WixUIExtension -ext WixUtilExtension -o "%~dp0\" + "%wixBinDir%\candle" "%~dp0\git_scm.wxs" -ext WixUIExtension -ext WixUtilExtension -o "%~dp0\" + "%wixBinDir%\candle" "%~dp0\images.wxs" -ext WixUIExtension -ext WixUtilExtension -o "%~dp0\" + "%wixBinDir%\candle" "%~dp0\presets.wxs" -ext WixUIExtension -ext WixUtilExtension -o "%~dp0\" + "%wixBinDir%\light" -ext WixUIExtension -ext WixUtilExtension "%~dp0Sparkleshare.wixobj" "%~dp0git_scm.wixobj" "%~dp0images.wixobj" "%~dp0presets.wixobj" -droot="%~dp0." -dgitscmpath="%OutputDir%\git_scm" -dimagespath="%OutputDir%\Images" -dpresetspath="%OutputDir%\Presets" -o "%~dp0SparkleShare.msi" if exist "%~dp0\SparkleShare.msi" echo SparkleShare.msi created. ) else ( echo Not building installer ^(could not find wix, Windows Installer XML toolset^) echo wix is available at http://wix.sourceforge.net/ + SET ERRORLEVEL=2 ) ) else echo Not building installer, as it was not requested. ^(Issue "build.cmd installer" to build installer ^) - diff --git a/SparkleShare/Windows/git.download b/SparkleShare/Windows/git.download new file mode 100644 index 000000000..b033dfca4 --- /dev/null +++ b/SparkleShare/Windows/git.download @@ -0,0 +1 @@ +https://github.com/git-for-windows/git/releases/download/v2.26.1.windows.1/PortableGit-2.26.1-32-bit.7z.exe 862fa87cb4c00872055efbdbf3ed0d5e87838605bb0c3024bed3b32acf43cc0c diff --git a/SparkleShare/Windows/packages.config b/SparkleShare/Windows/packages.config deleted file mode 100644 index 6c3600dac..000000000 --- a/SparkleShare/Windows/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/SparkleShare/Windows/postBuild.cmd b/SparkleShare/Windows/postBuild.cmd new file mode 100644 index 000000000..c00dacb2d --- /dev/null +++ b/SparkleShare/Windows/postBuild.cmd @@ -0,0 +1,47 @@ +@ECHO ON +setlocal enableDelayedExpansion +REM if no target directory is passed use default on +IF [%1]==[] (SET "OUTDIR=%~dp0bin\git_scm") ELSE (SET OUTDIR="%~1") + +IF EXIST %OUTDIR% GOTO skipgitdownload +ECHO installing git +REM download git +FOR /F "usebackq tokens=1" %%i IN ("%~dp0git.download") DO SET url=%%i +FOR /F "usebackq tokens=2" %%i IN ("%~dp0git.download") DO SET md5hash=%%i +CALL :downloadandverify %url% "%~dp0PortableGit.7z.exe" %md5hash% +"%~dp0PortableGit.7z.exe" -o %OUTDIR% -y +DEL "%~dp0PortableGit.7z.exe" +DEL /s /q "%~dp0OpenSSH-Win32.zip" + +:skipgitdownload +SET ERRORLEVEL=0 +ECHO ready + +:ready +endlocal +EXIT /B %ERRORLEVEL% + +:downloadandverify +REM first parameter url to download +REM second parameter local filename +REM third parameter md5string + +curl -L %~1 -o "%~2" +set "SHA256=" +for /f "skip=1 tokens=* delims=" %%# in ('certutil -hashfile "%~2" SHA256') do ( + if not defined SHA256 ( + for %%Z in (%%#) do set "SHA256=!SHA256!%%Z" + ) +) +if "%SHA256%" == "%~3" ( +echo +) else ( +del %~2 +goto :sha256error +) +goto:eof + +:sha256error +ECHO sha256 sum of download wrong +SET ERRORLEVEL=2 +goto ready diff --git a/Sparkles/Command.cs b/Sparkles/Command.cs index b49bc0ec4..9a2712246 100644 --- a/Sparkles/Command.cs +++ b/Sparkles/Command.cs @@ -18,13 +18,25 @@ using System; using System.Diagnostics; using System.IO; +using System.Reflection; +using System.Collections.Generic; namespace Sparkles { public class Command : Process { bool write_output; + static string[] extended_search_path; + public static void SetSearchPath(string[] pathes) + { + extended_search_path = pathes; + } + + public static void SetSearchPath(string path) + { + SetSearchPath(new string[] { path}); + } public Command (string path, string args) : this (path, args, write_output: true) { @@ -63,7 +75,8 @@ public Command (string path, string args, bool write_output) base.Start (); } catch (Exception e) { - Logger.LogInfo ("Cmd", "Couldn't execute command: " + e.Message); + Logger.LogInfo ("Cmd", "Couldn't execute command: " + +StartInfo.FileName+","+ e.Message); Environment.Exit (-1); } } @@ -116,20 +129,31 @@ public void SetEnvironmentVariable (string variable, string content) protected static string LocateCommand (string name) { - string [] possible_command_paths = { - Environment.GetFolderPath (Environment.SpecialFolder.Personal) + "/bin/" + name, - InstallationInfo.Directory + "/bin/" + name, - "/usr/local/bin/" + name, - "/usr/bin/" + name, - "/opt/local/bin/" + name + string[] possible_command_paths = { + Path.Combine(Environment.GetFolderPath (Environment.SpecialFolder.Personal), "bin"), + Path.Combine(InstallationInfo.Directory, "bin"), + "/usr/local/bin/", + "/usr/bin/", + "/opt/local/bin/" }; - foreach (string path in possible_command_paths) { - if (File.Exists (path)) + List command_paths = new List(); + command_paths.AddRange(extended_search_path); + command_paths.AddRange(possible_command_paths); + + foreach (string path in command_paths) { + if (File.Exists(Path.Combine(path,name))) + { return path; + } + else if (File.Exists(Path.Combine(path, name + ".exe"))) + { + return Path.Combine(path, name + ".exe"); + } } return name; } + } } diff --git a/Sparkles/Configuration.cs b/Sparkles/Configuration.cs index 83f5bb359..037b9331c 100644 --- a/Sparkles/Configuration.cs +++ b/Sparkles/Configuration.cs @@ -42,7 +42,6 @@ public class Configuration : XmlDocument { public readonly string DirectoryPath; public readonly string FilePath; public readonly string TmpPath; - public readonly string BinPath; public string AvatarProvider; public readonly string LogFilePath; @@ -73,11 +72,6 @@ public Configuration (string config_path, string config_file_name) FilePath = Path.Combine (config_path, config_file_name); DirectoryPath = config_path; - BinPath = Path.Combine (config_path, "bin"); - - if (!Directory.Exists (BinPath)) - Directory.CreateDirectory (BinPath); - string logs_path = Path.Combine (config_path, "logs"); int i = 1; diff --git a/Sparkles/Git/Git.Command.cs b/Sparkles/Git/Git.Command.cs index ffec4f603..4a4c44765 100644 --- a/Sparkles/Git/Git.Command.cs +++ b/Sparkles/Git/Git.Command.cs @@ -27,11 +27,12 @@ public class GitCommand : SSHCommand { static string git_path; - + static string git_lfs_path; + public static string GitPath { get { if (git_path == null) - git_path = LocateCommand ("git"); + git_path = LocateCommand ("git").Replace("\\", "/"); return git_path; } @@ -41,7 +42,19 @@ public static string GitPath { } } + public static string GitLfsPath { + get { + if (git_lfs_path == null) + git_lfs_path = LocateCommand ("git-lfs").Replace("\\","/"); + + return git_lfs_path; + } + set { + git_lfs_path = value; + } + } + public static string GitVersion { get { if (GitPath == null) @@ -221,9 +234,9 @@ static ErrorStatus FindError (string line) public static string FormatGitSSHCommand (SSHAuthenticationInfo auth_info) { - return SSHCommandPath + " " + - "-i " + auth_info.PrivateKeyFilePath.Replace ("\\", "/").Replace (" ", "\\ ") + " " + - "-o UserKnownHostsFile=" + auth_info.KnownHostsFilePath.Replace ("\\", "/").Replace (" ", "\\ ") + " " + + return "\""+SSHCommandPath + "\" " + + "-i \"" + auth_info.PrivateKeyFilePath.Replace ("\\", "/").Replace (" ", "\\ ") + "\" " + + "-o UserKnownHostsFile=\"" + auth_info.KnownHostsFilePath.Replace ("\\", "/").Replace (" ", "\\ ") + "\" " + "-o IdentitiesOnly=yes" + " " + // Don't fall back to other keys on the system "-o PasswordAuthentication=no" + " " + // Don't hang on possible password prompts "-F /dev/null"; // Ignore the system's SSH config file diff --git a/Sparkles/Git/Git.Fetcher.cs b/Sparkles/Git/Git.Fetcher.cs index 052638f6a..dc67ad56d 100644 --- a/Sparkles/Git/Git.Fetcher.cs +++ b/Sparkles/Git/Git.Fetcher.cs @@ -244,10 +244,10 @@ public override void EnableFetchedRepoCrypto (string password) var git_config_required = new GitCommand (TargetFolder, "config filter.encryption.required true"); var git_config_smudge = new GitCommand (TargetFolder, "config filter.encryption.smudge " + - string.Format ("\"openssl enc -d -aes-256-cbc -base64 -S {0} -pass file:{1} -md sha256\"", password_salt, password_file)); + string.Format ("\"'{0}' enc -d -aes-256-cbc -base64 -S {1} -pass file:{2} -md sha256\"", OpenSSLCommand.OpenSSLCommandPath, password_salt, password_file)); var git_config_clean = new GitCommand (TargetFolder, "config filter.encryption.clean " + - string.Format ("\"openssl enc -e -aes-256-cbc -base64 -S {0} -pass file:{1} -md sha256\"", password_salt, password_file)); + string.Format ("\"'{0}' enc -e -aes-256-cbc -base64 -S {1} -pass file:{2} -md sha256\"", OpenSSLCommand.OpenSSLCommandPath, password_salt, password_file)); git_config_required.StartAndWaitForExit (); git_config_smudge.StartAndWaitForExit (); @@ -279,7 +279,7 @@ public override bool IsFetchedRepoPasswordCorrect (string password) string args = string.Format ("enc -d -aes-256-cbc -base64 -S {0} -pass pass:{1} -in \"{2}\" -md sha256", password_salt, password.SHA256 (password_salt), password_check_file_path); - var process = new Command ("openssl", args); + var process = new OpenSSLCommand (args); process.StartInfo.WorkingDirectory = TargetFolder; process.StartAndWaitForExit (); @@ -427,16 +427,10 @@ void InstallGitLFS () string smudge_command; string clean_command; - if (InstallationInfo.OperatingSystem == OS.macOS || InstallationInfo.OperatingSystem == OS.Windows) { - smudge_command = "env GIT_SSH_COMMAND='" + GIT_SSH_COMMAND + "' " + - Path.Combine (Configuration.DefaultConfiguration.BinPath, "git-lfs").Replace ("\\", "/") + " smudge %f"; - clean_command = Path.Combine (Configuration.DefaultConfiguration.BinPath, "git-lfs").Replace ("\\", "/") + " clean %f"; + smudge_command = "env GIT_SSH_COMMAND='" + GIT_SSH_COMMAND.Replace("\"", "\\\"") + "' '" + GitCommand.GitLfsPath + "' smudge %f"; + clean_command = "'" + GitCommand.GitLfsPath + "' clean %f"; - } else { - smudge_command = "env GIT_SSH_COMMAND='" + GIT_SSH_COMMAND + "' git-lfs smudge %f"; - clean_command = "git-lfs clean %f"; - } var git_config_smudge = new GitCommand (TargetFolder, string.Format ("config filter.lfs.smudge \"{0}\"", smudge_command)); diff --git a/Sparkles/Git/Git.Repository.cs b/Sparkles/Git/Git.Repository.cs index ac19964cf..40485b380 100644 --- a/Sparkles/Git/Git.Repository.cs +++ b/Sparkles/Git/Git.Repository.cs @@ -79,7 +79,7 @@ public GitRepository (string path, Configuration config, SSHAuthenticationInfo a git_config = new GitCommand (LocalPath, "config remote.origin.url \"" + RemoteUrl + "\""); git_config.StartAndWaitForExit (); - git_config = new GitCommand (LocalPath, "config core.sshCommand " + GitCommand.FormatGitSSHCommand (auth_info)); + git_config = new GitCommand (LocalPath, "config core.sshCommand \"" + GitCommand.FormatGitSSHCommand (auth_info).Replace("\"", "\\\"") + "\""); git_config.StartAndWaitForExit(); PrepareGitLFS (); @@ -893,18 +893,11 @@ void PrepareGitLFS () string pre_push_hook_path = Path.Combine (LocalPath, ".git", "hooks", "pre-push"); string pre_push_hook_content; - if (InstallationInfo.OperatingSystem == OS.macOS || InstallationInfo.OperatingSystem == OS.Windows) { - pre_push_hook_content = - "#!/bin/sh" + Environment.NewLine + - "env GIT_SSH_COMMAND='" + GitCommand.FormatGitSSHCommand (auth_info) + "' " + - Path.Combine (Configuration.DefaultConfiguration.BinPath, "git-lfs").Replace ("\\", "/") + " pre-push \"$@\""; + pre_push_hook_content = + "#!/bin/sh" + Environment.NewLine + + "env GIT_SSH_COMMAND='" + GitCommand.FormatGitSSHCommand (auth_info) + "' " + "'"+ + GitCommand.GitLfsPath + "' pre-push \"$@\""; - } else { - pre_push_hook_content = - "#!/bin/sh" + Environment.NewLine + - "env GIT_SSH_COMMAND='" + GitCommand.FormatGitSSHCommand (auth_info) + "' " + - "git-lfs pre-push \"$@\""; - } if (InstallationInfo.OperatingSystem != OS.Windows) { // TODO: Use proper API diff --git a/Sparkles/OpenSSLCommand.cs b/Sparkles/OpenSSLCommand.cs new file mode 100644 index 000000000..fb6453783 --- /dev/null +++ b/Sparkles/OpenSSLCommand.cs @@ -0,0 +1,54 @@ +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +using System.IO; + +namespace Sparkles +{ + public class OpenSSLCommand : Command + { + public static string OpenSSLBinary = "openssl"; + public static string OpenSSLPath = Path.GetDirectoryName(LocateCommand(OpenSSLBinary)).Replace("\\", "/"); + + public static string OpenSSLCommandPath + { + get + { + return LocateCommand(OpenSSLBinary).Replace("\\", "/"); + } + } + + + public OpenSSLCommand(string command, string args) : + base(Path.Combine(OpenSSLPath, command), args) + { + } + public OpenSSLCommand(string args) : base(OpenSSLCommandPath, args) + { + } + public static string OpenSSLVersion + { + get + { + var openssl_version = new Command(OpenSSLCommandPath, "version", false); + + string version = openssl_version.StartAndReadStandardOutput(); + return version.Replace("OpenSSL ", "").Split(' ')[0]; + } + } + } +} diff --git a/Sparkles/SSHAuthenticationInfo.cs b/Sparkles/SSHAuthenticationInfo.cs index 0724a241d..6c51e71cc 100644 --- a/Sparkles/SSHAuthenticationInfo.cs +++ b/Sparkles/SSHAuthenticationInfo.cs @@ -100,7 +100,7 @@ bool CreateKeyPair () "-C \"" + computer_name + " (SparkleShare)\" " + // Key comment "-f \"" + key_file_name + "\""; - var ssh_keygen = new SSHCommand ("ssh-keygen", arguments); + var ssh_keygen = new SSHCommand (SSHCommand.SSHKeyGenCommandPath, arguments); ssh_keygen.StartInfo.WorkingDirectory = Path; ssh_keygen.StartAndWaitForExit (); diff --git a/Sparkles/SSHCommand.cs b/Sparkles/SSHCommand.cs index 3dd2f24b4..8425c7764 100644 --- a/Sparkles/SSHCommand.cs +++ b/Sparkles/SSHCommand.cs @@ -21,11 +21,25 @@ namespace Sparkles { public class SSHCommand : Command { - public static string SSHPath = ""; + public static string SSHPath = Path.GetDirectoryName(LocateCommand("ssh")).Replace("\\", "/"); public static string SSHCommandPath { get { - return Path.Combine (SSHPath, "ssh").Replace ("\\", "/"); + return LocateCommand("ssh").Replace ("\\", "/"); + } + } + public static string SSHKeyScanCommandPath + { + get + { + return LocateCommand("ssh-keyscan").Replace("\\", "/"); + } + } + public static string SSHKeyGenCommandPath + { + get + { + return LocateCommand("ssh-keygen").Replace("\\", "/"); } } @@ -36,8 +50,51 @@ public SSHCommand (string command, string args) : this (command, args, null) public SSHCommand (string command, string args, SSHAuthenticationInfo auth_info) : - base (Path.Combine (SSHPath, command), args) + base (command, args) + { + } + public static string SSHVersion { + get + { + var ssh_version = new Command(SSHCommandPath, "-V", false); + string version = ssh_version.StartAndReadStandardError(); //the version is written to StandardError instead of StanderdOutput! + return version.Replace("SSH ", "").Split(',')[0]; + } + } + public static string KeyscanVersion + { + get + { + var ssh_version = new Command(SSHKeyScanCommandPath, "",false); + ssh_version.StartAndWaitForExit(); // call to check if exists + return "found"; + } } + public static string KeygenVersion + { + get + { + // since keygen has no version output try to create testkey, if keygen is not found Comand will exit + string arguments = + "-t rsa " + // Crypto type + "-b 4096 " + // Key size + "-P \"\" " + // No password + "-C \"test\" " + // Key comment + "-f \"" + System.IO.Path.Combine(Configuration.DefaultConfiguration.DirectoryPath, "tmp", "testkey") + "\""; + var ssh_version = new Command(SSHKeyGenCommandPath, arguments,false); + ssh_version.StartAndWaitForExit(); // call to check if exists + if (File.Exists(System.IO.Path.Combine(Configuration.DefaultConfiguration.DirectoryPath, "tmp", "testkey"))) + { + File.Delete(System.IO.Path.Combine(Configuration.DefaultConfiguration.DirectoryPath, "tmp", "testkey")); + } + if (File.Exists(System.IO.Path.Combine(Configuration.DefaultConfiguration.DirectoryPath, "tmp", "testkey.pub"))) + { + File.Delete(System.IO.Path.Combine(Configuration.DefaultConfiguration.DirectoryPath, "tmp", "testkey.pub")); + } + return "found"; + } + } + } } diff --git a/Sparkles/SSHFetcher.cs b/Sparkles/SSHFetcher.cs index d7950b357..f7a96f475 100644 --- a/Sparkles/SSHFetcher.cs +++ b/Sparkles/SSHFetcher.cs @@ -23,9 +23,6 @@ namespace Sparkles { public abstract class SSHFetcher : BaseFetcher { - public static string SSHKeyScan = "ssh-keyscan"; - - protected SSHFetcher (SparkleFetcherInfo info) : base (info) { } @@ -68,7 +65,7 @@ public override bool Fetch () string FetchHostKey () { Logger.LogInfo ("Auth", string.Format ("Fetching host key for {0}", RemoteUrl.Host)); - var ssh_keyscan = new Command (SSHKeyScan, string.Format ("-t rsa -p 22 {0}", RemoteUrl.Host)); + var ssh_keyscan = new SSHCommand (SSHCommand.SSHKeyScanCommandPath, string.Format ("-t rsa -p 22 {0}", RemoteUrl.Host)); if (RemoteUrl.Port > 0) ssh_keyscan.StartInfo.Arguments = string.Format ("-t rsa -p {0} {1}", RemoteUrl.Port, RemoteUrl.Host); diff --git a/Sparkles/Sparkles.csproj b/Sparkles/Sparkles.csproj index e9c3bc995..54cfd66a6 100644 --- a/Sparkles/Sparkles.csproj +++ b/Sparkles/Sparkles.csproj @@ -45,13 +45,13 @@ true - ..\bin\ + .\Windows\bin\ DEBUG AnyCPU MinimumRecommendedRules.ruleset - ..\bin\ + .\Windows\bin\ true AnyCPU prompt @@ -76,6 +76,9 @@ Component + + Component + Component diff --git a/Sparkles/meson.build b/Sparkles/meson.build index e4261c561..5a6cbf68f 100644 --- a/Sparkles/meson.build +++ b/Sparkles/meson.build @@ -22,7 +22,8 @@ sparkles_src = ['AuthenticationInfo.cs', 'SSHFetcher.cs', 'TcpListener.cs', 'User.cs', - 'Watcher.cs'] + 'Watcher.cs', + 'OpenSSLCommand.cs'] sparkles = library('Sparkles', @@ -30,4 +31,3 @@ sparkles = library('Sparkles', cs_args: '-r:System.Xml.Linq', install: true, install_dir: install_dir) -