Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tunisiano187 committed Sep 22, 2024
2 parents 123381b + 7ad1b40 commit 9832f1a
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 28 deletions.
9 changes: 8 additions & 1 deletion automatic/audioshell/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ function global:au_SearchReplace {
}
}

function global:au_BeforeUpdate {
. ..\..\scripts\Get-FileVersion.ps1
$FileVersion = Get-FileVersion $Latest.URL32
$Latest.Checksum32 = $FileVersion.Checksum
$Latest.ChecksumType32 = $FileVersion.checksumType
}

function global:au_AfterUpdate($Package) {
Invoke-VirusTotalScan $Package
}
Expand All @@ -31,4 +38,4 @@ function global:au_GetLatest {
return $Latest
}

update -ChecksumFor 32 -NoCheckChocoVersion
update -ChecksumFor none
17 changes: 0 additions & 17 deletions automatic/gnu-units/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,12 @@

## GNU Units (Install)

---

### [choco://gnu-units](choco://gnu-units)
To use choco:// protocol URLs, install [(unofficial) choco:// Protocol support ](https://chocolatey.org/packages/choco-protocol-support)

---

GNU Units converts quantities expressed in various systems of measurement to their equivalents in other systems of measurement. Like many similar programs, it can handle multiplicative scale changes. It can also handle nonlinear conversions such as Fahrenheit to Celsius or wire gauge, and it can convert from and to sums of units, such as converting between meters and feet plus inches.

Beyond simple unit conversions, GNU Units can be used as a general-purpose scientific calculator that keeps track of units in its calculations. You can form arbitrary complex mathematical expressions of dimensions including sums, products, quotients, powers, and even roots of dimensions. Thus you can ensure accuracy and dimensional consistency when working with long expressions that involve many different units that may combine in complex ways.

The units are defined in an external data file. You can use the extensive data file that comes with this program, or you can provide your own data file to suit your needs. You can also use your own data file to supplement the standard data file.

**[PACKAGE NOTES](https://github.com/bcurran3/ChocolateyPackages/blob/master/gnu-units/readme.md)**



---

**Click here to [Patreon-ize](https://www.patreon.com/bcurran3) the package maintainer.**

---

#### [choco://gnu-units](choco://gnu-units)
To use choco:// protocol URLs, install [(unofficial) choco:// Protocol support ](https://chocolatey.org/packages/choco-protocol-support)

Expand Down
1 change: 1 addition & 0 deletions automatic/gnu-units/gnu-units.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ The units are defined in an external data file. You can use the extensive data f
<docsUrl>https://www.gnu.org/software/units/manual/</docsUrl>
</metadata>
<files>
<file src="legal\**" target="legal" />
<file src="tools\**" target="tools" />
</files>
</package>
File renamed without changes.
17 changes: 17 additions & 0 deletions automatic/gnu-units/legal/VERIFICATION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

1. Download the installer:

x32: https://sourceforge.net/projects/freeplane/files/freeplane%20stable/Freeplane-Setup-with-Java-1.12.5.exe/download

2. You can use one of the following methods to obtain the checksum:
- Use powershell function 'Get-FileHash'
- Use Chocolatey utility 'checksum.exe'
- Using AU:
Get-RemoteChecksum https://sourceforge.net/projects/freeplane/files/freeplane%20stable/Freeplane-Setup-with-Java-1.12.5.exe/download

3. Compare to Checksum:

checksum32: d214c610141466289b5bd717447626c706bab9aebb4fc86b6091f26ae5335523
3 changes: 2 additions & 1 deletion automatic/gnu-units/tools/ChocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
$ErrorActionPreference = 'Stop'
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$packageName = 'gnu-units'
$file = Get-Item $toolsPath\*.exe

$packageArgs = @{
packageName = $packageName
fileType = 'EXE'
file = "$toolsDir\units-2.22-setup.exe"
file = $file
validExitCodes = @(0)
silentArgs = '/VERYSILENT /NOCANCEL /CLOSEAPPLICATIONS /RESTART APPLICATIONS /NORESTART'
softwareName = 'units version 2.*'
Expand Down
9 changes: 0 additions & 9 deletions automatic/gnu-units/tools/VERIFICATION.txt

This file was deleted.

Binary file removed automatic/gnu-units/tools/units-2.22-setup.exe.sig
Binary file not shown.
67 changes: 67 additions & 0 deletions automatic/gnu-units/update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import-module au

$releases = 'https://ftp.gnu.org/gnu/units/windows/'

function global:au_SearchReplace {
@{
'.\legal\VERIFICATION.txt' = @{
"(?i)(\s+x32:).*" = "`${1} $($Latest.URL32)"
"(?i)(Get-RemoteChecksum).*" = "`${1} $($Latest.URL32)"
"(?i)(\s+checksum32:).*" = "`${1} $($Latest.Checksum32)"
}
}
}

function global:au_BeforeUpdate {
. ..\..\scripts\Get-FileVersion.ps1
$FileVersion = Get-FileVersion $Latest.URL32 -keep
Move-Item -Path $FileVersion.TempFile -Destination "tools\units-$($Latest.Version)-setup.exe"
$Latest.Checksum32 = $FileVersion.Checksum
$Latest.ChecksumType32 = $FileVersion.checksumType
}

function global:au_AfterUpdate($Package) {
Invoke-VirusTotalScan $Package
}

function global:au_GetLatest {
# URL of the GNU FTP directory
$url = "https://ftp.gnu.org/gnu/units/windows/"

# Fetch the HTML content from the page
$response = Invoke-WebRequest -Uri $url

# Extract all the file links from the page
$fileLinks = $response.Links | Where-Object { $_.href -match '\.exe$' }

# Define a regex pattern to extract the version numbers
$versionPattern = '(\d+\.\d+)'

# Initialize variables to store the highest version and its URL
$highestVersion = [Version]"0.0"
$highestVersionUrl = ""

# Iterate over each file link and compare versions
foreach ($link in $fileLinks) {
if ($link.href -match $versionPattern) {
$version = [Version]$matches[1]

# Compare the current version with the highest version found so far
if ($version -gt $highestVersion) {
$highestVersion = $version
$highestVersionUrl = $url + $link.href
}
}
}

# Output the URL of the file with the highest version
if ($highestVersionUrl) {
$url = $highestVersionUrl
$version = $highestVersion
}

$Latest = @{ URL32 = $url; Version = $version }
return $Latest
}

update -NoCheckChocoVersion

0 comments on commit 9832f1a

Please sign in to comment.