Skip to content

Commit

Permalink
Merge pull request #153 from main--/euro6
Browse files Browse the repository at this point in the history
Initial autoupdate implementation
  • Loading branch information
main-- authored Aug 8, 2017
2 parents 07c6c44 + abcead4 commit a4693b9
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 19 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ test:
cargo: # Simply always run cargo instead of tracking all the rs sources in here
cargo build --all --release --locked

$(GA_EXE): guest-agent/VfioService/VfioService.sln $(wildcard guest-agent/VfioService/VfioService/*.*) $(wildcard guest-agent/VfioService/VfioService/Properties/*)
$(GA_EXE): guest-agent/VfioService/VfioService.sln $(wildcard guest-agent/VfioService/VfioService/*.*) $(wildcard guest-agent/VfioService/VfioService/Properties/*) $(wildcard guest-agent/VfioService/Loader/*.*)
cd guest-agent/VfioService && nuget restore
xbuild /p:Configuration=Release guest-agent/VfioService/VfioService.sln
cp --preserve=timestamps guest-agent/VfioService/VfioService/bin/x86/Release/VfioService.exe guest-agent
cp --preserve=timestamps guest-agent/VfioService/VfioService/bin/x86/Release/Google.Protobuf.dll guest-agent
cp --preserve=timestamps guest-agent/VfioService/Loader/bin/Release/Loader.exe guest-agent/VfioService/VfioService/bin/x86/Release/VfioService.exe guest-agent/VfioService/VfioService/bin/x86/Release/Google.Protobuf.dll guest-agent

$(GA_ISO): $(GA_EXE) guest-agent/install.bat guest-agent/uninstall.bat
cd guest-agent && mkisofs -m VfioService -m .gitignore -m update-proto.bat -o windows-gaming-ga.iso -r -J -input-charset iso8859-1 -V "windows-gaming-ga" .
Expand Down
1 change: 1 addition & 0 deletions guest-agent/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VfioService.exe
Google.Protobuf.dll
Loader.exe
windows-gaming-ga.iso
36 changes: 36 additions & 0 deletions guest-agent/VfioService/Loader/Loader.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{2AE96B06-36C4-425B-BA80-55D7154FB195}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Loader</RootNamespace>
<AssemblyName>Loader</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
24 changes: 24 additions & 0 deletions guest-agent/VfioService/Loader/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.IO;
using System.Diagnostics;
using System.Linq;

namespace Loader
{
static class Program
{
static void Main()
{
var info = DriveInfo.GetDrives().Single(x => x.DriveType == DriveType.CDRom && x.VolumeLabel == "windows-gaming-g");
var service = info.RootDirectory.GetFiles("VfioService.exe").Single();

var psi = new ProcessStartInfo
{
FileName = service.FullName,
UseShellExecute = false,
WorkingDirectory = info.RootDirectory.FullName,
};
Process.Start(psi);
}
}
}
6 changes: 6 additions & 0 deletions guest-agent/VfioService/VfioService.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VfioService", "VfioService\VfioService.csproj", "{E9E97AB0-FCA9-4541-A039-18CC5BFDAC58}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Loader", "Loader\Loader.csproj", "{2AE96B06-36C4-425B-BA80-55D7154FB195}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Expand All @@ -15,6 +17,10 @@ Global
{E9E97AB0-FCA9-4541-A039-18CC5BFDAC58}.Debug|x86.Build.0 = Debug|x86
{E9E97AB0-FCA9-4541-A039-18CC5BFDAC58}.Release|x86.ActiveCfg = Release|x86
{E9E97AB0-FCA9-4541-A039-18CC5BFDAC58}.Release|x86.Build.0 = Release|x86
{2AE96B06-36C4-425B-BA80-55D7154FB195}.Debug|x86.ActiveCfg = Debug|x86
{2AE96B06-36C4-425B-BA80-55D7154FB195}.Debug|x86.Build.0 = Debug|x86
{2AE96B06-36C4-425B-BA80-55D7154FB195}.Release|x86.ActiveCfg = Release|x86
{2AE96B06-36C4-425B-BA80-55D7154FB195}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 3 additions & 5 deletions guest-agent/install.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@echo off
mkdir %APPDATA%\WindowsGamingGA
copy VfioService.exe %APPDATA%\WindowsGamingGA
copy Google.Protobuf.dll %APPDATA%\WindowsGamingGA
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /f /v WindowsGamingGA /t REG_SZ /d "%APPDATA%\WindowsGamingGA\VfioService.exe"
copy Loader.exe "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\VfioLoader.exe"
start VfioService.exe
echo Installation complete.
pause
pause
5 changes: 1 addition & 4 deletions guest-agent/uninstall.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
@echo off
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Run /f /v WindowsGamingGA
taskkill /f /im VfioService.exe
del %APPDATA%\WindowsGamingGA\VfioService.exe
rmdir %APPDATA%\WindowsGamingGA
del "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\VfioLoader.exe"
echo Uninstall complete.
pause
1 change: 1 addition & 0 deletions windows-gaming/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub struct Config {
pub samba: Option<SambaConfig>,
pub setup: Option<SetupConfig>,
pub additional_qemu_cmdline: Option<String>,
pub data_directory_override: Option<String>,
}

#[serde(default)]
Expand Down
10 changes: 7 additions & 3 deletions windows-gaming/driver/src/qemu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ pub fn run(cfg: &Config, tmp: &Path, data: &Path, clientpipe_path: &Path, monito
debug!("Samba started");
}

let ga_iso = data.join("windows-gaming-ga.iso");
assert!(ga_iso.exists());

notify_systemd(false, "Starting qemu ...");
trace!("starting qemu setup");
let mut qemu = Command::new(QEMU);
Expand All @@ -68,9 +71,10 @@ pub fn run(cfg: &Config, tmp: &Path, data: &Path, clientpipe_path: &Path, monito
data.join("ovmf-code.fd").display()),
"-drive",
&format!("if=pflash,format=raw,file={}", efivars_file.display()),
"-device", "virtio-scsi-pci,id=scsi"]);
// "-monitor",
// "telnet:127.0.0.1:31338,server,nowait"
"-device", "virtio-scsi-pci,id=scsi",
"-drive", &format!("if=none,id=iso,media=cdrom,file={}", ga_iso.display()),
"-device", "scsi-cd,id=cdrom,drive=iso",
]);

if let Some(ref setup) = cfg.setup {
if setup.gui {
Expand Down
13 changes: 9 additions & 4 deletions windows-gaming/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,14 @@ fn main() {

let control_socket = xdg_dirs.place_runtime_file("control.sock").unwrap();

let data_folder = Path::new(match cfg {
Some(Config { data_directory_override: Some(ref x), .. }) => x.as_str(),
_ => DATA_FOLDER,
}).to_owned();

match matches.subcommand() {
("run", _) => driver::run(&cfg.unwrap(), &workdir_path, Path::new(DATA_FOLDER)),
("wizard", _) => wizard::run(cfg, &config_path, &workdir_path, Path::new(DATA_FOLDER)),
("run", _) => driver::run(&cfg.unwrap(), &workdir_path, &data_folder),
("wizard", _) => wizard::run(cfg, &config_path, &workdir_path, &data_folder),
("control", cmd) => {
match cmd.unwrap().subcommand() {
("attach", cmd) => {
Expand All @@ -144,8 +149,8 @@ fn main() {
}
}
_ => match cfg {
Some(ref cfg) if cfg.setup.is_none() => driver::run(cfg, &workdir_path, Path::new(DATA_FOLDER)),
cfg => wizard::run(cfg, &config_path, &workdir_path, Path::new(DATA_FOLDER)),
Some(ref cfg) if cfg.setup.is_none() => driver::run(cfg, &workdir_path, &data_folder),
cfg => wizard::run(cfg, &config_path, &workdir_path, &data_folder),
}
}
}
Expand Down

0 comments on commit a4693b9

Please sign in to comment.