diff --git a/packages/kvm-virtio-drivers/kvm-virtio-drivers.nuspec b/packages/kvm-virtio-drivers/kvm-virtio-drivers.nuspec new file mode 100755 index 0000000..f9212ac --- /dev/null +++ b/packages/kvm-virtio-drivers/kvm-virtio-drivers.nuspec @@ -0,0 +1,20 @@ + + + + kvm-virtio-drivers + 0.1.141 + KVM Virtio Drivers for Windows + Red Hat + foo.li systeme + software + https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html + https://fedoraproject.org/wiki/Windows_Virtio_Drivers + https://raw.githubusercontent.com/peterbeck/chocolatey/master/icons/kvm.png + true + virtio drivers for Windows virtual machines running on KVM, and additional software agents for Windows VMs. + This package will download the latest stable drivers, unzip them and tries automatically to update/install needed drivers. + Note: for the QEMU guest agent there is a separate package available (which already uses this package as dependency). + KVM Virtio Drivers + upgrade to 0.1.141 + virtualisation kvm virtio guest-agents drivers + + diff --git a/packages/kvm-virtio-drivers/tools/RedHat.cer b/packages/kvm-virtio-drivers/tools/RedHat.cer new file mode 100755 index 0000000..91c8be6 Binary files /dev/null and b/packages/kvm-virtio-drivers/tools/RedHat.cer differ diff --git a/packages/kvm-virtio-drivers/tools/RedHatOLD.cer b/packages/kvm-virtio-drivers/tools/RedHatOLD.cer new file mode 100755 index 0000000..589daa1 Binary files /dev/null and b/packages/kvm-virtio-drivers/tools/RedHatOLD.cer differ diff --git a/packages/kvm-virtio-drivers/tools/chocolateyinstall.ps1 b/packages/kvm-virtio-drivers/tools/chocolateyinstall.ps1 new file mode 100755 index 0000000..f8da0a7 --- /dev/null +++ b/packages/kvm-virtio-drivers/tools/chocolateyinstall.ps1 @@ -0,0 +1,108 @@ +# Virtio Drivers for Windows VMs running on KVM +# 2011-2017 foo.li systeme + software + +# export installed redhat certificate to a file with win7 +# $CertToExport = dir cert:\LocalMachine -Recurse | where {$_.ThumbPrint -eq "66ED6843B0F6DC9B636C6814E53A26983EF32B4E"} +# $CertToExportInBytesForCERFile = $CertToExport.export("Cert") +# [system.IO.file]::WriteAllBytes("C:\Temp\RedHat.cer", $CertToExportInBytesForCERFile) + +$packageName = 'kvm-virtio-drivers' +$version = '0.1.141' +$url = 'https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso' +$url64 = $url +$virtioPath = "$env:SystemDrive" + "\Virtio_" + $version +$scriptPath = $(Split-Path $MyInvocation.MyCommand.Path) +$dpinst = Join-Path $scriptPath 'dpinstX86.exe' +$dpinst64 = Join-Path $scriptPath 'dpinstX64.exe' +$dpinstxml = Join-Path $scriptPath 'dpinst.xml' +$cleanupdrv = Join-Path $scriptPath 'cleanfolder.ps1' +$checksum = '43AEFA812C37342CFEFC48EC0DD7F1E56A930FCD' +$checksumType = 'sha1' +$checksum64 = $checksum +$checksumType64 = $checksumType + +$cert = ls cert: -Recurse | ? { $_.Thumbprint -eq '66ED6843B0F6DC9B636C6814E53A26983EF32B4E' } +if (!$cert) { + Write-Debug 'adding RedHat certificate to TrustedPublishers' + $toolsPath = Split-Path $MyInvocation.MyCommand.Definition + Start-ChocolateyProcessAsAdmin "certutil -addstore 'TrustedPublisher' '$toolsPath\RedHat.cer'" +} + +if ([System.Environment]::Is64BitProcess) { +#if ($env:PROCESSOR_ARCHICTECTURE -eq 'AMD64') { #does not work when run in choco ?! + $dpinstsrc = $dpinst64 + $dpinstbin = "${virtioPath}\${dpinst64}" + $dpinstaller = "${virtioPath}\dpinstX64.exe" + $arch = 'amd64' +} else { + $dpinstsrc = $dpinst + $dpinstbin = "${virtioPath}\${dpinst}" + $dpinstaller = "${virtioPath}\dpinstX86.exe" + $arch = 'x86' +} + +try { + if (!(Test-Path $virtioPath)) { + New-Item $virtioPath -ItemType Directory + } + Write-Host 'unzipping files to ' $virtioPath + Write-Host "[INFO]: use the package 'qemu-guest-agent' to install the QEMU Guest Agent." + Install-ChocolateyZipPackage -PackageName $packageName -Url $url -UnzipLocation $virtioPath ` + -checksum $checksum -checksumType $checksumType -checksum64 -$checksum64 -checksumType64 $checksumType64 + Copy-Item -Path $dpinstsrc -Destination $virtioPath #-ErrorAction SilentlyContinue + Copy-Item -Path $dpinstxml -Destination $virtioPath #-ErrorAction SilentlyContinue + + #Remove unneeded architectures and os first to avoid installing wrong drivers and safe space + $lvl1 = (Get-ChildItem -Path $virtioPath -Exclude qemupciserial | ?{ $_.PSIsContainer } | % { $_.FullName }) + + $OS = (Get-WmiObject -class Win32_OperatingSystem).Caption + + switch -wildcard -casesensitive ($OS) { + "*Windows 7*" { Write-Host "Windows 7 detected";$d="w7";break} + "*Windows 10*" { Write-Host "Windows 10 detected";$d="w10";break } + "*Server 2003*" { Write-Host "Server 2003 detected";$d="2k3";break } + "*Server 2008 R2*" { Write-Host "Server 2008 R2 detected";$d="2k8R2";break } + "*Server* 2008*" { Write-Host "Server 2008 detected";$d="2k8";break } #copyright logo, really ?! fucking windows world + "*Server 2012 R2*" { Write-Host "Server 2012 R2 detected";$d="2k12R2";break } + "*Server 2012*" { Write-Host "Server 2012 detected";$d="2k12";break } + "*Server 2016*" { Write-Host "Server 2016 detected";$d="2k16";break } + default {"unknown/unsupported os"; exit 1 } + } + + #os detection/removal currently tested with: win7x64,win10x64,2008,2008R2,2012R2,2016 + $wrongos = (Get-ChildItem -Path $lvl1 -Recurse -Exclude $d| ?{ $_.PSIsContainer -and $_.FullName -notlike "*$d*" }) + if (!($wrongos -eq $null)) { #do not run a second time when there is nothing to do + Write-Host "removing unneeded Operating Systems.." + foreach ($dir in $wrongos) { + Remove-Item $dir.FullName -Recurse -Force -ea SilentlyContinue + } + } + + $wrongarch = (Get-ChildItem -Path $lvl1 -Recurse | ?{ $_.PSIsContainer -and $_.FullName -notlike "*$arch*" -and $_.FullName -notlike "*$d" }) + if (!($wrongarch -eq $null)) { #do not run a second time when there is nothing to do + Write-Host "removing unneeded architecture..." + foreach ($archdir in $wrongarch) { + foreach ($ad in $archdir) { + if ($ad -notlike "*$arch*") { + Remove-Item $ad.FullName -Recurse -Force -ea SilentlyContinue + } + } + } + } + + #we do not need virtual floppy images, save some space ;-) + Remove-Item -Path "${virtioPath}\virtio-win-${version}_amd64.vfd" -Force -ErrorAction SilentlyContinue + Remove-Item -Path "${virtioPath}\virtio-win-${version}_x86.vfd" -Force -ErrorAction SilentlyContinue + + Write-Host 'trying to install drivers from' $virtioPath '.This may take a while...' + $cleanupdrv + Write-Host 'even the package setup finishes successfully,' + Write-Host 'the driver wizard will still run for quiet some time.' + #Start-ChocolateyProcessAsAdmin -Statements "/q /se /sw /sa /path $virtioPath" -ExeToRun $dpinstaller + & $dpinstaller /S /SA /SE /SW /PATH $virtioPath + Write-Host '[INFO]: The Logfile for the driver installations is %windir%\DPINST.LOG' + Write-Host '[INFO]: removing previous virtio-driver versions' + Remove-Item "${env:SystemDrive}\Virtio_0.1.126" -Force -Recurse -ErrorAction SilentlyContinue +} catch { + throw $_.Exception +} diff --git a/packages/kvm-virtio-drivers/tools/chocolateyuninstall.ps1 b/packages/kvm-virtio-drivers/tools/chocolateyuninstall.ps1 new file mode 100755 index 0000000..ae70431 --- /dev/null +++ b/packages/kvm-virtio-drivers/tools/chocolateyuninstall.ps1 @@ -0,0 +1,18 @@ +# Spice Guest Tools Removal +# 2017 foo.li systeme + software + +$packageName = 'kvm-virito-drivers' +$version = '0.1.126' +$virtioPath = "$env:SystemDrive" + "\Virtio_" + $version + +try { + if (Test-Path $virtioPath) { + Write-Host 'removing directory ' $virtioPath + Remove-Item $virtioPath -Recurse -Force + } else { + Write-Host 'could not detect ' $virtioPath ' files.' + } + Write-Host '[NOTE]: this does not remove any installed drivers, just the sourcefiles.' +} catch { + throw $_.Exception +} diff --git a/packages/kvm-virtio-drivers/tools/dpinst.xml b/packages/kvm-virtio-drivers/tools/dpinst.xml new file mode 100755 index 0000000..f4b596d --- /dev/null +++ b/packages/kvm-virtio-drivers/tools/dpinst.xml @@ -0,0 +1,6 @@ + + + + * + + \ No newline at end of file diff --git a/packages/kvm-virtio-drivers/tools/dpinstX64.exe b/packages/kvm-virtio-drivers/tools/dpinstX64.exe new file mode 100755 index 0000000..0096441 Binary files /dev/null and b/packages/kvm-virtio-drivers/tools/dpinstX64.exe differ diff --git a/packages/kvm-virtio-drivers/tools/dpinstX86.exe b/packages/kvm-virtio-drivers/tools/dpinstX86.exe new file mode 100755 index 0000000..410a135 Binary files /dev/null and b/packages/kvm-virtio-drivers/tools/dpinstX86.exe differ