Compare commits
No commits in common. "master" and "v1.0.3" have entirely different histories.
23
README.md
23
README.md
|
@ -8,27 +8,30 @@ Updates, compiles and sets up your CitizenMP server automagically!
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
- Compatible with both Microsoft .NET Framework 4.5+ and Mono 3.0+ (Mac OS X support planned)
|
- Compatible with both Microsoft .NET Framework and Mono (Mac OS X support planned)
|
||||||
- Creates ready-to-use start scripts for your platform
|
- Creates ready-to-use start scripts for your platform
|
||||||
- No extra setup besides requirements listed below needed
|
- No extra setup besides usual requirements needed
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
First of all, you'll need Windows or Linux to run this tool. Currently, since no libgit2 binaries can be provided for Mac OS X, this tool won't work there. Here's the guaranteed compatible list of OS this tool can be run on:
|
First of all, you'll need Windows or Linux to run this tool. Currently, since no libgit2 binaries can be provided for Mac OS X, this tool won't work there. Here's the guaranteed compatible list of OS this tool can be run on:
|
||||||
|
|
||||||
- Ubuntu 12.04 LTS or higher, including 14.xx
|
- Ubuntu 12.04 (old LTS) or higher, including 14.xx
|
||||||
- Debian 7.x (Wheezy) or higher, including testing and sid installations
|
- Debian 7.x (Wheezy) or higher, including testing and sid installations
|
||||||
- Every other currently stable Linux distribution with up-to-date Mono
|
- Every other currently stable Linux distribution should work just fine as well
|
||||||
- Any Windows operating system with .NET Framework 4.5 Full on it
|
- Any Windows operating system with .NET Framework 4 Full on it
|
||||||
|
|
||||||
To run this program and the resulting server, you need the following components:
|
To run this program and the resulting server, you need the following components:
|
||||||
|
|
||||||
- _On Windows:_ .NET Framework 4.5 or newer ([Download](http://microsoft.com/download/details.aspx?id=30653))
|
- _On Windows:_ .NET Framework 4 or newer
|
||||||
- _On Linux:_ Mono 3.x or newer, runtime + xbuild files ([Installation instructions](http://www.mono-project.com/docs/getting-started/install/linux/))
|
- _On Linux:_ Mono 2.10.x/3.x or newer
|
||||||
|
|
||||||
*Note that Mono 2.10.x/.NET 4 are not supported!*
|
On Ubuntu and Debian you can just install all requirements with this command:
|
||||||
If you use a Debian-based distribution that still only offers Mono binaries older than 3.x, you must [switch to Xamarin's Debian repository](http://www.mono-project.com/docs/getting-started/install/linux/).
|
|
||||||
|
```
|
||||||
|
sudo apt-get install mono-runtime libmono-system-core4.0-cil
|
||||||
|
```
|
||||||
|
|
||||||
Guides
|
Guides
|
||||||
------
|
------
|
||||||
|
@ -42,7 +45,7 @@ Usage
|
||||||
This tool ships with a usage screen that will be printed if this tool is run without arguments. It looks similar to the following:
|
This tool ships with a usage screen that will be printed if this tool is run without arguments. It looks similar to the following:
|
||||||
|
|
||||||
```
|
```
|
||||||
CitizenMP Server Updater 1.0.3
|
CitizenMP Server Updater 1.0.1+Branch.master.Sha.4475e9becd5fa22563a92fe202f8df21329969fc
|
||||||
© 2014-2015 Carl Kittelberger
|
© 2014-2015 Carl Kittelberger
|
||||||
|
|
||||||
This is free software. You may redistribute copies of it under the terms of the MIT License <http://www.opensource.org/licenses/mit-license.php>.
|
This is free software. You may redistribute copies of it under the terms of the MIT License <http://www.opensource.org/licenses/mit-license.php>.
|
||||||
|
|
|
@ -3,11 +3,10 @@ Easy server installation on Windows
|
||||||
|
|
||||||
On Windows, you can mostly avoid using the command line for easy usage. Instead, just drag and drop an empty folder onto it. Below is a detailed explanation:
|
On Windows, you can mostly avoid using the command line for easy usage. Instead, just drag and drop an empty folder onto it. Below is a detailed explanation:
|
||||||
|
|
||||||
1. Make sure at least .NET Framework 4.5 is installed on your server computer. If not, [you can download it from Microsoft's website](http://microsoft.com/download/details.aspx?id=30653).
|
1. Make sure at least .NET Framework 4 is installed on your server computer. If not, you can download it [here](http://microsoft.com/download/details.aspx?id=17718).
|
||||||
2. Make sure Microsoft Build Tools 2013 is installed on your server computer, [downloadable from Microsoft as well](http://microsoft.com/download/details.aspx?id=40760).
|
2. Download citimp_upd.exe from [here](https://github.com/icedream/citizenmp-server-updater/releases). The newest version is always at the top. Alternatively, you can also [get the latest build from the build server](http://builds.icedream.kthx.at/citiserver-updater-master/lastSuccessfulBuild/citimp_upd.exe), which is a little bit slower.
|
||||||
3. Download citimp_upd.exe from [here](https://github.com/icedream/citizenmp-server-updater/releases). The newest version is always at the top. Alternatively, you can also [get the latest build from the build server](http://builds.icedream.kthx.at/citiserver-updater-master/lastSuccessfulBuild/citimp_upd.exe), which is a little bit slower.
|
3. Create a new dedicated folder for citimp_upd.exe. It will later contain both your new server and the source code the tool downloads. Name it something like "CitizenMP" or similar. Move the file into the folder.
|
||||||
4. Create a new dedicated folder for citimp_upd.exe. It will later contain both your new server and the source code the tool downloads. Name it something like "CitizenMP" or similar. Move the file into the folder.
|
4. Inside the folder, create a new folder which will contain your server build. Name it something like "Server" or similar.
|
||||||
5. Inside the folder, create a new folder which will contain your server build. Name it something like "Server" or similar.
|
5. Drag and drop your newly created folder onto citimp_upd.exe. Wait for the tool to download, compile and prepare your server. The window should go away when done.
|
||||||
6. Drag and drop your newly created folder onto citimp_upd.exe. Wait for the tool to download, compile and prepare your server. the window should go away when done.
|
6. Now open your folder and like magic, some new files will be in there. Usually, you will now have to edit the configuration file before starting the server, so now would be a good time to do your custom changes.
|
||||||
7. Now open your folder and like magic, some new files will be in there. Usually, you will now have to edit the configuration file before starting the server, so now would be a good time to do your custom changes.
|
7. When done, save any files you have open and start the server using the start.bat script that the tool generated for you. The server should display a new window and start up properly.
|
||||||
8. When done, save any files you have open and start the server using the start.bat script that the tool generated for you. The server should display a new window and start up properly.
|
|
|
@ -3,8 +3,8 @@ Server installation on Linux
|
||||||
|
|
||||||
On Linux, you should use a terminal (SSH connection/XTerm/...) to set up your server.
|
On Linux, you should use a terminal (SSH connection/XTerm/...) to set up your server.
|
||||||
|
|
||||||
1. Make sure you have the newest Mono 3.x installed on your server computer (you can check the version using ```mono -V```). If not, [you should follow the official installation instructions](http://www.mono-project.com/docs/getting-started/install/linux/).
|
1. Make sure at least Mono 2.10.x is installed on your server computer. If not, you can install it using your distribution's package manager. For Debian/Ubuntu the command would normally be ```sudo apt-get install mono-runtime libmono-system-core4.0-cil```.
|
||||||
2. Download the latest citimp_upd.exe from [here](https://github.com/icedream/citizenmp-server-updater/releases/latest). If you are using SSH and want the file downloaded quickly or just generally want a direct download onto your server, this command should do: ```wget https://github.com/icedream/citizenmp-server-updater/releases/download/v1.1.0/citimp_upd.exe```
|
2. Download the latest citimp_upd.exe from [here](https://github.com/downloads/icedream/citizenmp-server-updater/citimp_upd.exe). You automate this using this command: ```wget https://github.com/icedream/citizenmp-server-updater/releases/download/v1.0.3/citimp_upd.exe```
|
||||||
3. Create a new dedicated folder for citimp_upd.exe. It will later contain both your new server and the source code the tool downloads. Name it something like "CitizenMP" or similar. Move the file into the folder. Command for that would be ```mkdir CitizenMP```
|
3. Create a new dedicated folder for citimp_upd.exe. It will later contain both your new server and the source code the tool downloads. Name it something like "CitizenMP" or similar. Move the file into the folder. Command for that would be ```mkdir CitizenMP```
|
||||||
4. Inside the folder, create a new folder which will contain your server build. Name it something like "Server" or similar. Command for this would be ```cd CitizenMP && mkdir Server```
|
4. Inside the folder, create a new folder which will contain your server build. Name it something like "Server" or similar. Command for this would be ```cd CitizenMP && mkdir Server```
|
||||||
5. Run the tool and tell it to install files into your newly created folder. Command: ```mono citimp_upd.exe Server```
|
5. Run the tool and tell it to install files into your newly created folder. Command: ```mono citimp_upd.exe Server```
|
||||||
|
|
|
@ -1,16 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<runtime>
|
<startup>
|
||||||
<generatePublisherEvidence enabled="false" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
</startup>
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="12.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="12.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
</configuration>
|
|
@ -1,16 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<runtime>
|
|
||||||
<generatePublisherEvidence enabled="false" />
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="12.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="12.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
|
|
@ -9,7 +9,7 @@
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>CitizenMP.Server.Installer</RootNamespace>
|
<RootNamespace>CitizenMP.Server.Installer</RootNamespace>
|
||||||
<AssemblyName>citizenmp_server_updater</AssemblyName>
|
<AssemblyName>citizenmp_server_updater</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<NuGetPackageImportStamp>95b7e825</NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>95b7e825</NuGetPackageImportStamp>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
|
@ -48,21 +48,29 @@
|
||||||
<StartupObject>CitizenMP.Server.Installer.Program</StartupObject>
|
<StartupObject>CitizenMP.Server.Installer.Program</StartupObject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="CommandLine">
|
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
|
||||||
<HintPath>$(SolutionDir)\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>$(SolutionDir)\packages\CommandLineParser.1.9.71\lib\net40\CommandLine.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Build, Version=12.0.0.0" />
|
<Reference Include="Microsoft.Build" />
|
||||||
<Reference Include="Microsoft.Build.Engine, Version=12.0.0.0" />
|
<Reference Include="Microsoft.Build.Conversion.v4.0" />
|
||||||
<Reference Include="Microsoft.Build.Framework, Version=12.0.0.0" />
|
<Reference Include="Microsoft.Build.Engine" />
|
||||||
|
<Reference Include="Microsoft.Build.Framework" />
|
||||||
|
<Reference Include="Microsoft.Build.Tasks.v4.0" />
|
||||||
|
<Reference Include="Microsoft.Build.Utilities.v4.0" />
|
||||||
<Reference Include="Mono.Posix">
|
<Reference Include="Mono.Posix">
|
||||||
<HintPath>$(SolutionDir)\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll</HintPath>
|
<HintPath>$(SolutionDir)\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="CommandLineOptions.cs" />
|
<Compile Include="CommandLineOptions.cs" />
|
||||||
<Compile Include="Extensions.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="RepositoryExtensions.cs" />
|
<Compile Include="RepositoryExtensions.cs" />
|
||||||
|
@ -89,7 +97,6 @@
|
||||||
<EmbeddedResource Include="costura64\git2-91fa31f.dll" />
|
<EmbeddedResource Include="costura64\git2-91fa31f.dll" />
|
||||||
<EmbeddedResource Include="costura32\*.so" />
|
<EmbeddedResource Include="costura32\*.so" />
|
||||||
<EmbeddedResource Include="costura64\*.so" />
|
<EmbeddedResource Include="costura64\*.so" />
|
||||||
<EmbeddedResource Include="AppDomainConfigurations\BuildNET45.xml" />
|
|
||||||
<Content Include="FodyWeavers.xml">
|
<Content Include="FodyWeavers.xml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -195,6 +202,7 @@ if [ ! -e "$(SolutionDir)src/updater/costura32"/git*.so ]; then
|
||||||
fi
|
fi
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<Import Project="$(SolutionDir)packages\Fody.1.26.1\build\Fody.targets" Condition="Exists('$(SolutionDir)packages\Fody.1.26.1\build\Fody.targets')" />
|
||||||
<Import Project="$(SolutionDir)packages\Fody.1.26.4\build\Fody.targets" Condition="Exists('..\..\packages\Fody.1.26.4\build\Fody.targets')" />
|
<Import Project="$(SolutionDir)packages\Fody.1.26.4\build\Fody.targets" Condition="Exists('..\..\packages\Fody.1.26.4\build\Fody.targets')" />
|
||||||
<Import Project="$(SolutionDir)packages\GitVersionTask.2.0.0\Build\GitVersionTask.targets" Condition="Exists('..\..\packages\GitVersionTask.2.0.0\Build\GitVersionTask.targets')" />
|
<Import Project="$(SolutionDir)packages\GitVersionTask.2.0.0\Build\GitVersionTask.targets" Condition="Exists('..\..\packages\GitVersionTask.2.0.0\Build\GitVersionTask.targets')" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace CitizenMP.Server.Installer
|
|
||||||
{
|
|
||||||
internal static class Extensions
|
|
||||||
{
|
|
||||||
public static bool IsWin32(this OperatingSystem os)
|
|
||||||
{
|
|
||||||
return os.Platform == PlatformID.Win32NT ||
|
|
||||||
os.Platform == PlatformID.Win32S ||
|
|
||||||
os.Platform == PlatformID.Win32Windows;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Weavers>
|
<Weavers>
|
||||||
<Costura CreateTemporaryAssemblies="true"/>
|
<Costura CreateTemporaryAssemblies="true" />
|
||||||
</Weavers>
|
</Weavers>
|
|
@ -13,6 +13,7 @@ using Microsoft.Build.Evaluation;
|
||||||
using Microsoft.Build.Execution;
|
using Microsoft.Build.Execution;
|
||||||
using Microsoft.Build.Framework;
|
using Microsoft.Build.Framework;
|
||||||
using Mono.Unix.Native;
|
using Mono.Unix.Native;
|
||||||
|
using Project = Microsoft.Build.BuildEngine.Project;
|
||||||
using UnixSyscall = Mono.Unix.Native.Syscall;
|
using UnixSyscall = Mono.Unix.Native.Syscall;
|
||||||
|
|
||||||
namespace CitizenMP.Server.Installer
|
namespace CitizenMP.Server.Installer
|
||||||
|
@ -58,13 +59,6 @@ namespace CitizenMP.Server.Installer
|
||||||
|
|
||||||
private static int Main(string[] args)
|
private static int Main(string[] args)
|
||||||
{
|
{
|
||||||
var monoRun = RunWithMonoConfiguration(args);
|
|
||||||
if (monoRun.Item1)
|
|
||||||
{
|
|
||||||
// The main stuff already ran in a subprocess
|
|
||||||
return monoRun.Item2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse cmdline arguments
|
// Parse cmdline arguments
|
||||||
var options = new CommandLineOptions();
|
var options = new CommandLineOptions();
|
||||||
//args = args.DefaultIfEmpty("--help").ToArray();
|
//args = args.DefaultIfEmpty("--help").ToArray();
|
||||||
|
@ -244,7 +238,7 @@ namespace CitizenMP.Server.Installer
|
||||||
{
|
{
|
||||||
{"Configuration", "Release"},
|
{"Configuration", "Release"},
|
||||||
{"Platform", "Any CPU"},
|
{"Platform", "Any CPU"},
|
||||||
{"DebugType", Environment.OSVersion.IsWin32() ? "None" : "pdbonly"},
|
{"DebugType", IsWin32() ? "None" : "pdbonly"},
|
||||||
{"DebugSymbols", false.ToString()},
|
{"DebugSymbols", false.ToString()},
|
||||||
{"OutputPath", binOutputDirectory.FullName},
|
{"OutputPath", binOutputDirectory.FullName},
|
||||||
{"AllowedReferenceRelatedFileExtensions", "\".mdb\"=\"\";\".pdb\"=\"\";\".xml\"=\"\""}
|
{"AllowedReferenceRelatedFileExtensions", "\".mdb\"=\"\";\".pdb\"=\"\";\".xml\"=\"\""}
|
||||||
|
@ -321,62 +315,6 @@ namespace CitizenMP.Server.Installer
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Tuple<bool, int> RunWithMonoConfiguration(string[] args)
|
|
||||||
{
|
|
||||||
if (Environment.OSVersion.IsWin32())
|
|
||||||
{
|
|
||||||
// .NET Framework does everything properly anyways
|
|
||||||
return new Tuple<bool, int>(false, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var engineAssembly =
|
|
||||||
Assembly.Load(
|
|
||||||
"Microsoft.Build.Engine, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
|
|
||||||
.GetName();
|
|
||||||
if (engineAssembly.Version.Major < 12)
|
|
||||||
{
|
|
||||||
//var baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
|
||||||
var baseDir = Path.GetDirectoryName(Assembly.Load("CommandLine").Location);
|
|
||||||
if (baseDir == null)
|
|
||||||
throw new DirectoryNotFoundException("Could not find base directory");
|
|
||||||
|
|
||||||
var tempExePath = Path.Combine(baseDir, new Random().Next(10000, 99999) + ".exe");
|
|
||||||
File.Copy(Assembly.GetExecutingAssembly().Location, tempExePath);
|
|
||||||
|
|
||||||
var tempConfigPath = tempExePath + ".config";
|
|
||||||
using (var tempConfig = File.OpenWrite(tempConfigPath))
|
|
||||||
{
|
|
||||||
using (
|
|
||||||
var srcConfig =
|
|
||||||
Assembly.GetExecutingAssembly()
|
|
||||||
.GetManifestResourceStream(
|
|
||||||
"CitizenMP.Server.Installer.AppDomainConfigurations.BuildNET45.xml"))
|
|
||||||
{
|
|
||||||
if (srcConfig == null)
|
|
||||||
throw new FileNotFoundException("Could not find config resource");
|
|
||||||
srcConfig.CopyTo(tempConfig);
|
|
||||||
srcConfig.Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AppDomain.CurrentDomain.DomainUnload += (sender, e) =>
|
|
||||||
{
|
|
||||||
File.Delete(tempConfigPath);
|
|
||||||
File.Delete(tempExePath);
|
|
||||||
};
|
|
||||||
|
|
||||||
var arguments = string.Join(" ",
|
|
||||||
new[] {tempExePath}.Concat(args)
|
|
||||||
.Select(a => "\"" + a.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""));
|
|
||||||
var exitCode = RunProcess("mono", arguments, new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{"MONO_IOMAP", "all"}
|
|
||||||
});
|
|
||||||
return new Tuple<bool, int>(true, exitCode);
|
|
||||||
}
|
|
||||||
return new Tuple<bool, int>(false, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool Build(string projectFilePath, IDictionary<string, string> buildProperties,
|
private static bool Build(string projectFilePath, IDictionary<string, string> buildProperties,
|
||||||
LoggerVerbosity verbosity, string logPath = null)
|
LoggerVerbosity verbosity, string logPath = null)
|
||||||
{
|
{
|
||||||
|
@ -411,7 +349,7 @@ namespace CitizenMP.Server.Installer
|
||||||
loggers.Add(new ConsoleLogger(verbosity) {ShowSummary = false});
|
loggers.Add(new ConsoleLogger(verbosity) {ShowSummary = false});
|
||||||
|
|
||||||
// Import/Update Mozilla certs for NuGet to not fail out on non-Windows machines
|
// Import/Update Mozilla certs for NuGet to not fail out on non-Windows machines
|
||||||
if (!Environment.OSVersion.IsWin32())
|
if (!IsWin32())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -419,18 +357,15 @@ namespace CitizenMP.Server.Installer
|
||||||
{
|
{
|
||||||
if (s == null || !s.Contains("X.509 Certificate"))
|
if (s == null || !s.Contains("X.509 Certificate"))
|
||||||
return;
|
return;
|
||||||
writer.WriteLine("yes");
|
writer.WriteLine("y");
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Make sure this does not fail out by checking if mozroots is installed
|
// TODO: Make sure this does not fail out by checking if mozroots is installed
|
||||||
Console.WriteLine("Updating SSL certificates for NuGet...");
|
Console.WriteLine("Updating SSL certificates for NuGet...");
|
||||||
RunProcessThrowOnException("mozroots", "--import --sync --quiet");
|
Run("mozroots", "--import --sync --quiet");
|
||||||
RunProcessThrowOnException("certmgr", "-ssl https://go.microsoft.com",
|
Run("certmgr", "-ssl https://go.microsoft.com", automaticYesResponder);
|
||||||
lineProcessor: automaticYesResponder);
|
Run("certmgr", "-ssl https://nugetgallery.blob.core.windows.net", automaticYesResponder);
|
||||||
RunProcessThrowOnException("certmgr", "-ssl https://nugetgallery.blob.core.windows.net",
|
Run("certmgr", "-ssl https://nuget.org", automaticYesResponder);
|
||||||
lineProcessor: automaticYesResponder);
|
|
||||||
RunProcessThrowOnException("certmgr", "-ssl https://nuget.org",
|
|
||||||
lineProcessor: automaticYesResponder);
|
|
||||||
}
|
}
|
||||||
catch (Exception error)
|
catch (Exception error)
|
||||||
{
|
{
|
||||||
|
@ -451,27 +386,18 @@ namespace CitizenMP.Server.Installer
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use a different build route if running on the Mono interpreter
|
// Use a different build route if running on the Mono interpreter
|
||||||
if (!Environment.OSVersion.IsWin32())
|
if (!IsWin32())
|
||||||
{
|
{
|
||||||
|
// Build doesn't work with the new API on Mono, use the deprecated api
|
||||||
Console.WriteLine("Building server binaries...");
|
Console.WriteLine("Building server binaries...");
|
||||||
#pragma warning disable 618
|
#pragma warning disable 618
|
||||||
// Build doesn't work with the new API on Mono, use the deprecated api
|
|
||||||
var engine = Engine.GlobalEngine;
|
|
||||||
|
|
||||||
// loggers
|
|
||||||
foreach (var logger in loggers)
|
foreach (var logger in loggers)
|
||||||
engine.RegisterLogger(logger);
|
Engine.GlobalEngine.RegisterLogger(logger);
|
||||||
|
var project = new Project(Engine.GlobalEngine) {BuildEnabled = true};
|
||||||
// Apply build properties
|
project.Load(projectFilePath);
|
||||||
var buildPropertiesConverted = new BuildPropertyGroup();
|
|
||||||
engine.GlobalProperties = buildPropertiesConverted;
|
|
||||||
foreach (var property in buildProperties)
|
foreach (var property in buildProperties)
|
||||||
buildPropertiesConverted.SetProperty(property.Key, property.Value);
|
project.GlobalProperties.SetProperty(property.Key, property.Value);
|
||||||
|
var result = project.Build();
|
||||||
// Load project
|
|
||||||
var result = engine.BuildProjectFile(projectFilePath, new string[0], null, null,
|
|
||||||
BuildSettings.None,
|
|
||||||
null);
|
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -480,8 +406,7 @@ namespace CitizenMP.Server.Installer
|
||||||
{
|
{
|
||||||
Console.WriteLine("Building server binaries...");
|
Console.WriteLine("Building server binaries...");
|
||||||
|
|
||||||
var buildReq = new BuildRequestData(projectFilePath, buildProperties, null, new[] {"Build"},
|
var buildReq = new BuildRequestData(projectFilePath, buildProperties, null, new[] {"Build"}, null);
|
||||||
null);
|
|
||||||
|
|
||||||
var result = BuildManager.DefaultBuildManager.Build(
|
var result = BuildManager.DefaultBuildManager.Build(
|
||||||
new BuildParameters(pc)
|
new BuildParameters(pc)
|
||||||
|
@ -499,42 +424,18 @@ namespace CitizenMP.Server.Installer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RunProcessThrowOnException(string name, string args,
|
private static void Run(string name, string args, Action<string, StreamWriter> lineProcessor = null)
|
||||||
IDictionary<string, string> envVars = null,
|
|
||||||
Action<string, StreamWriter> lineProcessor = null)
|
|
||||||
{
|
{
|
||||||
var exitCode = RunProcess(name, args, envVars, lineProcessor);
|
using (var p = Process.Start(new ProcessStartInfo
|
||||||
|
|
||||||
if (exitCode != 0)
|
|
||||||
{
|
{
|
||||||
throw new Exception(string.Format("Process \"{0} {1}\" exited with error code {2}",
|
Arguments = args,
|
||||||
name, args, exitCode));
|
FileName = name,
|
||||||
}
|
UseShellExecute = false,
|
||||||
}
|
CreateNoWindow = true,
|
||||||
|
RedirectStandardInput = lineProcessor != null,
|
||||||
private static int RunProcess(string name, string args, IDictionary<string, string> envVars = null,
|
RedirectStandardOutput = lineProcessor != null
|
||||||
Action<string, StreamWriter> lineProcessor = null)
|
}))
|
||||||
{
|
|
||||||
using (var p = new Process
|
|
||||||
{
|
{
|
||||||
StartInfo =
|
|
||||||
{
|
|
||||||
Arguments = args,
|
|
||||||
FileName = name,
|
|
||||||
UseShellExecute = false,
|
|
||||||
CreateNoWindow = true,
|
|
||||||
WorkingDirectory = Environment.CurrentDirectory,
|
|
||||||
RedirectStandardInput = lineProcessor != null,
|
|
||||||
RedirectStandardOutput = lineProcessor != null
|
|
||||||
}
|
|
||||||
})
|
|
||||||
{
|
|
||||||
if (envVars != null)
|
|
||||||
foreach (KeyValuePair<string, string> i in envVars)
|
|
||||||
p.StartInfo.EnvironmentVariables.Add(i.Key, i.Value);
|
|
||||||
|
|
||||||
p.Start();
|
|
||||||
|
|
||||||
if (lineProcessor == null)
|
if (lineProcessor == null)
|
||||||
{
|
{
|
||||||
p.WaitForExit();
|
p.WaitForExit();
|
||||||
|
@ -548,8 +449,19 @@ namespace CitizenMP.Server.Installer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return p.ExitCode;
|
if (p.ExitCode != 0)
|
||||||
|
{
|
||||||
|
throw new Exception(string.Format("Process \"{0} {1}\" exited with error code {2}",
|
||||||
|
name, args, p.ExitCode));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsWin32()
|
||||||
|
{
|
||||||
|
return Environment.OSVersion.Platform == PlatformID.Win32NT ||
|
||||||
|
Environment.OSVersion.Platform == PlatformID.Win32S ||
|
||||||
|
Environment.OSVersion.Platform == PlatformID.Win32Windows;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
|
<package id="CommandLineParser" version="1.9.71" targetFramework="net40" />
|
||||||
<package id="Costura.Fody-Mono" version="1.3.3.5" targetFramework="net45" developmentDependency="true" />
|
<package id="Costura.Fody-Mono" version="1.3.3.5" targetFramework="net40" developmentDependency="true" />
|
||||||
<package id="Fody" version="1.26.4" targetFramework="net40" developmentDependency="true" />
|
<package id="Fody" version="1.26.4" targetFramework="net40" developmentDependency="true" />
|
||||||
<package id="GitVersionTask" version="2.0.0" targetFramework="net40" developmentDependency="true" />
|
<package id="GitVersionTask" version="2.0.0" targetFramework="net40" developmentDependency="true" />
|
||||||
<package id="Mono.Posix" version="4.0.0.0" targetFramework="net45" />
|
<package id="Mono.Posix" version="4.0.0.0" targetFramework="net45" />
|
||||||
|
|
|
@ -1,16 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<runtime>
|
<startup>
|
||||||
<generatePublisherEvidence enabled="false" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
</startup>
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="12.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="12.0.0.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
|
||||||
</runtime>
|
|
||||||
</configuration>
|
</configuration>
|
|
@ -9,7 +9,7 @@
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>CitizenMP.Server.Updater.Wrapper</RootNamespace>
|
<RootNamespace>CitizenMP.Server.Updater.Wrapper</RootNamespace>
|
||||||
<AssemblyName>citimp_upd</AssemblyName>
|
<AssemblyName>citimp_upd</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||||
|
@ -95,7 +95,8 @@
|
||||||
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System" />
|
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System" />
|
||||||
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.IO" />
|
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.IO" />
|
||||||
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.Xml.Linq" />
|
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.Xml.Linq" />
|
||||||
<Code xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Type="Fragment" Language="cs"><![CDATA[
|
<Code xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Type="Fragment" Language="cs">
|
||||||
|
<![CDATA[
|
||||||
var config = XElement.Load(Config.ItemSpec).Elements("Costura").FirstOrDefault();
|
var config = XElement.Load(Config.ItemSpec).Elements("Costura").FirstOrDefault();
|
||||||
|
|
||||||
if (config == null) return true;
|
if (config == null) return true;
|
||||||
|
@ -114,8 +115,8 @@ var filesToCleanup = Files.Select(f => f.ItemSpec).Where(f => !excludedAssemblie
|
||||||
|
|
||||||
foreach (var item in filesToCleanup)
|
foreach (var item in filesToCleanup)
|
||||||
File.Delete(item);
|
File.Delete(item);
|
||||||
]]></Code>
|
]]>
|
||||||
</Task>
|
</Code></Task>
|
||||||
</UsingTask>
|
</UsingTask>
|
||||||
<Target Name="CleanReferenceCopyLocalPaths" AfterTargets="AfterBuild;NonWinFodyTarget">
|
<Target Name="CleanReferenceCopyLocalPaths" AfterTargets="AfterBuild;NonWinFodyTarget">
|
||||||
<CosturaCleanup Config="FodyWeavers.xml" Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
|
<CosturaCleanup Config="FodyWeavers.xml" Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Weavers>
|
<Weavers>
|
||||||
<Costura CreateTemporaryAssemblies="true"/>
|
<Costura/>
|
||||||
</Weavers>
|
</Weavers>
|
|
@ -1,11 +1,10 @@
|
||||||
using System;
|
using System.Linq;
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
internal static class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
private static int Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var mainAsm = Assembly.Load("citizenmp_server_updater");
|
var mainAsm = Assembly.Load("citizenmp_server_updater");
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ internal static class Program
|
||||||
.GetMethod("Attach")
|
.GetMethod("Attach")
|
||||||
.Invoke(null, null);
|
.Invoke(null, null);
|
||||||
|
|
||||||
return (int) mainAsm.GetType("CitizenMP.Server.Installer.Program")
|
mainAsm.GetType("CitizenMP.Server.Installer.Program")
|
||||||
.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static)
|
.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static)
|
||||||
.Invoke(null, new object[] {args});
|
.Invoke(null, new object[] {args});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue