Skip to content

Commit

Permalink
refactor(steamlink)(#189): new automatic package
Browse files Browse the repository at this point in the history
  • Loading branch information
pauby committed Mar 10, 2024
1 parent f1b7f57 commit 91a71ee
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 0 deletions.
8 changes: 8 additions & 0 deletions automatic/steamlink/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ![Steam Link](https://cdn.jsdelivr.net/gh/pauby/ChocoPackages@b7c36f1/icons/steam.png "Steam Logo") [Steam Link](https://chocolatey.org/packages/steamlink)

Play your Steam games on your phone, tablet, TV, VR headset or another PC using Steam Link, streaming from your home computer. With control schemes optimized for hundreds of top titles, you can now access and play games from your PC while on the couch, or on the go.

## Notes

* This application ONLY supports Windows 10 and 11.
* This is an automatically updated package. If you find it is out of date by more than a week, please contact the maintainer(s) and let them know the package is no longer updating correctly.
65 changes: 65 additions & 0 deletions automatic/steamlink/steamlink.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<!-- == PACKAGE SPECIFIC SECTION == -->
<!-- This section is about this package, although id and version have ties back to the software -->
<!-- id is lowercase and if you want a good separator for words, use '-', not '.'. Dots are only acceptable as suffixes for certain types of packages, e.g. .install, .portable, .extension, .template -->
<!-- If the software is cross-platform, attempt to use the same id as the debian/rpm package(s) if possible. -->
<id>steamlink</id>
<!-- version should MATCH as closely as possible with the underlying software -->
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
<version>1.3.8</version>
<packageSourceUrl>https://github.com/pauby/chocopackages/tree/master/automatic/steamlink</packageSourceUrl>
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
<owners>pauby</owners>
<!-- ============================== -->

<!-- == SOFTWARE SPECIFIC SECTION == -->
<!-- This section is about the software itself -->
<title>Steam Link</title>
<authors>Valve Corporation</authors>
<!-- projectUrl is required for the community feed -->
<projectUrl>https://store.steampowered.com/app/353380/Steam_Link/</projectUrl>
<iconUrl>https://cdn.jsdelivr.net/gh/pauby/ChocoPackages@b7c36f1/icons/steam.png</iconUrl>
<copyright>2024 Valve Corporation</copyright>
<!-- If there is a license Url available, it is is required for the community feed -->
<!-- <licenseUrl></licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance> -->
<!-- <projectSourceUrl></projectSourceUrl> -->
<docsUrl>https://store.steampowered.com/manual/353380</docsUrl>
<mailingListUrl>https://steamcommunity.com/app/353380/discussions/</mailingListUrl>
<!-- <bugTrackerUrl></bugTrackerUrl> -->
<tags>steam vr</tags>
<summary>Play your Steam games on your phone, tablet, TV, VR headset or another PC using Steam Link, streaming from your home computer.</summary>
<description>Play your Steam games on your phone, tablet, TV, VR headset or another PC using Steam Link, streaming from your home computer. With control schemes optimized for hundreds of top titles, you can now access and play games from your PC while on the couch, or on the go.

## Notes

* This application ONLY supports Windows 10 and 11.
* This is an automatically updated package. If you find it is out of date by more than a week, please contact the maintainer(s) and let them know the package is no longer updating correctly.
</description>
<releaseNotes>https://store.steampowered.com/newshub/?appids=353380</releaseNotes>
<!-- =============================== -->

<!-- Specifying dependencies and version ranges? https://docs.nuget.org/create/versioning#specifying-version-ranges-in-.nuspec-files -->
<!--<dependencies>-->
<!-- <dependency id="dotnet4.5"/>
<dependency id="" version="[__EXACT_VERSION__]" />
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_INCLUSIVE]" />
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_EXCLUSIVE)" />
<dependency id="" />
<dependency id="chocolatey-uninstall.extension" /> -->
<!--/dependencies>-->
<!-- chocolatey-uninstall.extension - If supporting 0.9.9.x (or below) and including a chocolateyUninstall.ps1 file to uninstall an EXE/MSI, you probably want to include chocolatey-uninstall.extension as a dependency. Please verify whether you are using a helper function from that package. -->

<!--<provides>NOT YET IMPLEMENTED</provides>-->
<!--<conflicts>NOT YET IMPLEMENTED</conflicts>-->
<!--<replaces>NOT YET IMPLEMENTED</replaces>-->
</metadata>
<files>
<!-- this section controls what actually gets packaged into the Chocolatey package -->
<file src="tools\**" target="tools" />
<!--Building from Linux? You may need this instead: <file src="tools/**" target="tools" />-->
</files>
</package>
27 changes: 27 additions & 0 deletions automatic/steamlink/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$ErrorActionPreference = 'Stop'

$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$logFilename = "{0}-{1}.log" -f $env:ChocolateyPackageName, $env:ChocolateyPackageVersion
$logPath = Join-Path -Path $env:TEMP -ChildPath $logFilename

$packageArgs = @{
PackageName = $env:ChocolateyPackageName
Url = 'https://media.steampowered.com/steamlink/windows/latest/SteamLink.zip'
UnzipLocation = $toolsDir

checksum = '48E16CF4257170F0A6879336065B7DB8DA64ED587157FCC75B3888451C4929A9'
checksumType = 'SHA256'
}

Install-ChocolateyZipPackage @packageArgs

$installArgs = @{
packageName = $env:ChocolateyPackageName
fileType = 'MSI'
file = Join-Path -Path $toolsDir -ChildPath 'SteamLink.msi'

silentArgs = "/quiet /lv $logPath"
validExitCodes = @(0, 3010, 1641)
}

Install-ChocolateyInstallPackage @installArgs
Empty file.
47 changes: 47 additions & 0 deletions automatic/steamlink/update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
. $PSScriptRoot\..\..\scripts\all.ps1

function global:au_SearchReplace {
@{
".\tools\chocolateyInstall.ps1" = @{
'(^\s*url\s*=\s*)(''.*'')' = "`$1'$($Latest.Url32)'"
"(?i)(^\s*checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'"
"(?i)(^\s*checksumType\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType32)'"
}
}
}


function global:au_BeforeUpdate() {
}

function global:au_AfterUpdate {
Set-DescriptionFromReadme -SkipFirst 2
}

function global:au_GetLatest {
$url32 = 'https://media.steampowered.com/steamlink/windows/latest/SteamLink.zip'

$tempFolder = Join-Path -Path $env:TEMP -ChildPath ([GUID]::NewGuid()).ToString()
$zipPath = Join-Path -Path $tempFolder -ChildPath 'SteamLink.zip'
$msiPath = Join-Path -Path $tempFolder -ChildPath 'SteamLink.msi'

New-Item -Path $tempFolder -Force -ItemType Directory
Invoke-WebRequest -Uri $url32 -OutFile $zipPath

& 7z.exe e -aoa $zipPath "SteamLink.msi" -o"$tempFolder"

$version = & lessmsi v $msiPath

if ($version -notmatch "[\d]*\.[\d]*\.[\d]*(\.[\d])?") {
throw "Version number '$version' isn't a valid version as it doesn't match the regex"
}

return @{
Url32 = $url32
Version = $version
Checksum32 = (Get-FileHash -Path $zipPath -Algorithm 'SHA256').Hash
ChecksumType32 = 'SHA256'
}
}

Update-Package -ChecksumFor none

0 comments on commit 91a71ee

Please sign in to comment.