Skip to content

Commit ce8e146

Browse files
committed
cleaned chocolatey scripts
1 parent 4b725ff commit ce8e146

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/Chocolatey/chocolateyInstall.ps1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11

22
$packageName = "ServiceControl"
33

4-
$url = gci -path "c:\ChocolateyResourceCache" -Filter "Particular.ServiceControl-*.exe" -ErrorAction SilentlyContinue | select -first 1
4+
$url = gci -path "c:\ChocolateyResourceCache" -Filter "Particular.$packageName-*.exe" -ErrorAction SilentlyContinue| select -first 1
55

66
if($url){
77
$url = $url | Select -expandProperty FullName
88
}
99
else{
10-
$url = "https://github.com/Particular/$packageName/releases/download/{{ReleaseName}}/Particular.$packageName-{{FileVersion}}.exe"
10+
$url = "https://github.com/Particular/$packageName/releases/download/{{ReleaseName}}/Particular.$packageName-{{FileVersion}}.exe"
1111
}
1212

1313

14-
1514
try {
1615

1716
$existngService = Get-Service -Name "Particular.Management" -ErrorAction SilentlyContinue
@@ -20,9 +19,7 @@ try {
2019
}
2120

2221
$chocTempDir = Join-Path $env:TEMP "chocolatey"
23-
2422
$tempDir = Join-Path $chocTempDir "$packageName"
25-
2623
if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir) | Out-Null}
2724
$file = Join-Path $tempDir "$($packageName)Install.exe"
2825
$logFile = Join-Path $tempDir "msiexe.log"
@@ -35,8 +32,8 @@ try {
3532
$msiArguments ="/quiet /L*V `"$logFile`""
3633
Write-Host "Starting installer with arguments: $msiArguments";
3734
Start-ChocolateyProcessAsAdmin "$msiArguments" $file -validExitCodes 0
38-
3935
Write-ChocolateySuccess $packageName
36+
Remove-Item $file -ErrorAction SilentlyContinue
4037
} catch {
4138
Write-ChocolateyFailure $packageName $($_.Exception.Message)
4239
throw

src/Chocolatey/elevatedUninstall.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$productName = "ServiceControl";
22
$version = "MajorMinorPatch";
33

4-
$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "$productName*" -and ($_.Version -eq "$version") }
4+
$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "*$productName*" -and ($_.Version -eq "$version") }
55
if($app -eq $null)
66
{
77
Write-Warning "Could not find an installed program for $productName matching version $version to uninstall. It may have been manualy removed. To check the cuurent status ensure that no instance of $productName exists in 'Programs and Features'."

0 commit comments

Comments
 (0)