diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml index 657eb3b7..4dc1ac79 100644 --- a/.github/workflows/update.yaml +++ b/.github/workflows/update.yaml @@ -36,7 +36,11 @@ jobs: - name: Install Chocolatey Core Extensions run: | - choco install chocolatey-core.extension + choco install -y chocolatey-core.extension + + - name: Install Megatools + run: | + choco install -y megatools - name: Install AU run: | diff --git a/manual/jdownloader/README.md b/automatic/jdownloader/README.md similarity index 100% rename from manual/jdownloader/README.md rename to automatic/jdownloader/README.md diff --git a/manual/jdownloader/jdownloader.nuspec b/automatic/jdownloader/jdownloader.nuspec similarity index 99% rename from manual/jdownloader/jdownloader.nuspec rename to automatic/jdownloader/jdownloader.nuspec index 69ae9557..00f91bb3 100644 --- a/manual/jdownloader/jdownloader.nuspec +++ b/automatic/jdownloader/jdownloader.nuspec @@ -89,6 +89,7 @@ distribution rights. --> + diff --git a/automatic/jdownloader/legal/VERIFICATION.txt b/automatic/jdownloader/legal/VERIFICATION.txt new file mode 100644 index 00000000..52466a04 --- /dev/null +++ b/automatic/jdownloader/legal/VERIFICATION.txt @@ -0,0 +1,15 @@ +VERIFICATION +Verification is intended to assist the Chocolatey moderators and community +in verifying that the contents of this package is trustworthy. + +The installer has been downloaded from the official download link listed on +and can be verified like this: + +1. Download the following installers: + url: EMPTY +2. You can use one of the following methods to obtain the checksum + - Use powershell function 'Get-Filehash' + - Use chocolatey utility 'checksum.exe' + + checksum type: sha256 + checksum64: EMPTY \ No newline at end of file diff --git a/automatic/jdownloader/tools/chocolateyInstall.ps1 b/automatic/jdownloader/tools/chocolateyInstall.ps1 new file mode 100644 index 00000000..14d1160c --- /dev/null +++ b/automatic/jdownloader/tools/chocolateyInstall.ps1 @@ -0,0 +1,12 @@ +$ErrorActionPreference = 'Stop' +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" + +$packageArgs = @{ + packageName = $env:ChocolateyPackageName + fileType = 'EXE' + file = Get-Item "$toolsDir\*.exe" + silentArgs = "-q" + validExitCodes = @(0) +} + +Install-ChocolateyPackage @packageArgs diff --git a/automatic/jdownloader/update.ps1 b/automatic/jdownloader/update.ps1 new file mode 100644 index 00000000..30dd4550 --- /dev/null +++ b/automatic/jdownloader/update.ps1 @@ -0,0 +1,36 @@ +$ErrorActionPreference = 'Stop' +Import-Module -Name 'au' + +function global:au_SearchReplace { + @{ + '.\legal\VERIFICATION.txt' = @{ + '(?i)(\s+url:).*' = "`${1} $($Latest.URL)" + '(?i)(\s+checksum64:).*' = "`${1} $($Latest.Checksum64)" + } + } +} + +function global:au_AfterUpdate { + Set-DescriptionFromReadme -SkipFirst 2 +} + +function global:au_GetLatest { + + $DownloadsPage = Invoke-WebRequest -UseBasicParsing -Uri 'https://jdownloader.org/jdownloader2' + $MegaLink = ($DownloadsPage.Links | Where-Object -Property 'href' -Match 'https://mega.nz/file/')[0] + + $InstallerPath = '.\tools\JDownloader2Setup.exe' + $TempPath = $InstallerPath + '.tmp' + megatools dl --no-progress --path="$TempPath" $MegaLink.href + Move-Item -Path $TempPath -Destination $InstallerPath -Force + $latestVersion = (Get-Item $InstallerPath).VersionInfo.FileVersion + $latestChecksum64 = (Get-FileHash -Path $InstallerPath -Algorithm 'SHA256').Hash + + return @{ + URL = $MegaLink.href + Version = $latestVersion + Checksum64 = $latestChecksum64 + } +} + +update -ChecksumFor none \ No newline at end of file diff --git a/manual/jdownloader/tools/chocolateyInstall.ps1 b/manual/jdownloader/tools/chocolateyInstall.ps1 deleted file mode 100644 index e2d68054..00000000 --- a/manual/jdownloader/tools/chocolateyInstall.ps1 +++ /dev/null @@ -1,16 +0,0 @@ -$ErrorActionPreference = 'Stop' - -$packageArgs = @{ - packageName = $env:ChocolateyPackageName - fileType = 'EXE' - url = 'https://installer.jdownloader.org/JD2SilentSetup_x86.exe' - checksum = '44a43ca37cffd3ee30f06dba4117e8b2a10682cf6ee7bd217cd0133c6d9806bb' - checksumType = 'SHA256' - url64 = 'https://installer.jdownloader.org/JD2SilentSetup_x64.exe' - checksum64 = 'd08732950ee05f0aa7c346bb3cbe04195374a2949c01588955e2128d544722b6' - checksumType64 = 'SHA256' - silentArgs = "-q" - validExitCodes = @(0) -} - -Install-ChocolateyPackage @packageArgs