-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from okta/lr-add-choco-files
Add Chocolatey files.
- Loading branch information
Showing
3 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. --> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>okta-aws-cli</id> | ||
<version>2.0.1</version> | ||
<owners>Okta, Inc.</owners> | ||
<title>Okta AWS CLI (Install)</title> | ||
<authors>Okta</authors> | ||
<packageSourceUrl>https://github.com/okta/okta-aws-cli/tree/master/nuspec/chocolatey</packageSourceUrl> | ||
<projectUrl>https://github.com/okta/okta-aws-cli</projectUrl> | ||
<iconUrl>https://cdn.brandfolder.io/R30ALRIS/at/mtg52xxxcr939z2ns8jrg3mz/Okta_Aura_CMYK_Black.png</iconUrl> | ||
<copyright>2024-Present Okta, Inc.</copyright> | ||
<licenseUrl>https://github.com/okta/okta-aws-cli/blob/master/LICENSE.md</licenseUrl> | ||
<requireLicenseAcceptance>true</requireLicenseAcceptance> | ||
<tags>okta-aws-cli okta aws cli oauth oauth2</tags> | ||
<summary>A CLI for having Okta as the IdP for AWS CLI operations</summary> | ||
<description>A CLI for having Okta as the IdP for AWS CLI operations</description> | ||
<releaseNotes>https://github.com/okta/okta-aws-cli/releases</releaseNotes> | ||
</metadata> | ||
<files> | ||
<!-- this section controls what actually gets packaged into the Chocolatey package --> | ||
<file src="tools\**" target="tools" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
$ErrorActionPreference = 'Stop' | ||
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" | ||
$url = 'https://github.com/okta/okta-aws-cli/releases/download/v2.0.1/okta-aws-cli_2.0.1_windows_386.zip' | ||
|
||
$packageArgs = @{ | ||
packageName = $env:ChocolateyPackageName | ||
unzipLocation = $toolsDir | ||
url = $url | ||
checksum = 'F05862D42BF14133EFA88C9F77C0AB942858CA0FFDE980D0615395E8E48FD4D6' | ||
checksumType = 'sha256' | ||
} | ||
|
||
Install-ChocolateyZipPackage @packageArgs | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# IMPORTANT: Before releasing this package, copy/paste the next 2 lines into PowerShell to remove all comments from this file: | ||
# $f='c:\path\to\thisFile.ps1' | ||
# gc $f | ? {$_ -notmatch "^\s*#"} | % {$_ -replace '(^.*?)\s*?[^``]#.*','$1'} | Out-File $f+".~" -en utf8; mv -fo $f+".~" $f | ||
|
||
## NOTE: In 80-90% of the cases (95% with licensed versions due to Package Synchronizer and other enhancements), | ||
## AutoUninstaller should be able to detect and handle registry uninstalls without a chocolateyUninstall.ps1. | ||
## See https://docs.chocolatey.org/en-us/choco/commands/uninstall | ||
## and https://docs.chocolatey.org/en-us/create/functions/uninstall-chocolateypackage | ||
|
||
## If this is an MSI, ensure 'softwareName' is appropriate, then clean up comments and you are done. | ||
## If this is an exe, change fileType, silentArgs, and validExitCodes | ||
|
||
$ErrorActionPreference = 'Stop' # stop on all errors | ||
$packageArgs = @{ | ||
packageName = $env:ChocolateyPackageName | ||
softwareName = 'okta-aws-cli*' #part or all of the Display Name as you see it in Programs and Features. It should be enough to be unique | ||
fileType = 'EXE_MSI_OR_MSU' #only one of these: MSI or EXE (ignore MSU for now) | ||
# MSI | ||
silentArgs = "/qn /norestart" | ||
validExitCodes= @(0, 3010, 1605, 1614, 1641) # https://msdn.microsoft.com/en-us/library/aa376931(v=vs.85).aspx | ||
# OTHERS | ||
# Uncomment matching EXE type (sorted by most to least common) | ||
#silentArgs = '/S' # NSIS | ||
#silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' # Inno Setup | ||
#silentArgs = '/s' # InstallShield | ||
#silentArgs = '/s /v"/qn"' # InstallShield with MSI | ||
#silentArgs = '/s' # Wise InstallMaster | ||
#silentArgs = '-s' # Squirrel | ||
#silentArgs = '-q' # Install4j | ||
#silentArgs = '-s -u' # Ghost | ||
# Note that some installers, in addition to the silentArgs above, may also need assistance of AHK to achieve silence. | ||
#silentArgs = '' # none; make silent with input macro script like AutoHotKey (AHK) | ||
# https://community.chocolatey.org/packages/autohotkey.portable | ||
#validExitCodes= @(0) #please insert other valid exit codes here | ||
} | ||
|
||
[array]$key = Get-UninstallRegistryKey -SoftwareName $packageArgs['softwareName'] | ||
|
||
if ($key.Count -eq 1) { | ||
$key | % { | ||
$packageArgs['file'] = "$($_.UninstallString)" #NOTE: You may need to split this if it contains spaces, see below | ||
|
||
if ($packageArgs['fileType'] -eq 'MSI') { | ||
# The Product Code GUID is all that should be passed for MSI, and very | ||
# FIRST, because it comes directly after /x, which is already set in the | ||
# Uninstall-ChocolateyPackage msiargs (facepalm). | ||
$packageArgs['silentArgs'] = "$($_.PSChildName) $($packageArgs['silentArgs'])" | ||
|
||
# Don't pass anything for file, it is ignored for msi (facepalm number 2) | ||
# Alternatively if you need to pass a path to an msi, determine that and | ||
# use it instead of the above in silentArgs, still very first | ||
$packageArgs['file'] = '' | ||
} else { | ||
# NOTES: | ||
# - You probably will need to sanitize $packageArgs['file'] as it comes from the registry and could be in a variety of fun but unusable formats | ||
# - Split args from exe in $packageArgs['file'] and pass those args through $packageArgs['silentArgs'] or ignore them | ||
# - Ensure you don't pass double quotes in $file (aka $packageArgs['file']) - otherwise you will get "Illegal characters in path when you attempt to run this" | ||
# - Review the code for auto-uninstaller for all of the fun things it does in sanitizing - https://github.com/chocolatey/choco/blob/bfe351b7d10c798014efe4bfbb100b171db25099/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs#L142-L192 | ||
} | ||
|
||
Uninstall-ChocolateyPackage @packageArgs | ||
} | ||
} elseif ($key.Count -eq 0) { | ||
Write-Warning "$packageName has already been uninstalled by other means." | ||
} elseif ($key.Count -gt 1) { | ||
Write-Warning "$($key.Count) matches found!" | ||
Write-Warning "To prevent accidental data loss, no programs will be uninstalled." | ||
Write-Warning "Please alert package maintainer the following keys were matched:" | ||
$key | % {Write-Warning "- $($_.DisplayName)"} | ||
} | ||
|
||
## OTHER POWERSHELL FUNCTIONS | ||
## https://docs.chocolatey.org/en-us/create/functions | ||
#Uninstall-ChocolateyZipPackage $packageName # Only necessary if you did not unpack to package directory - see https://docs.chocolatey.org/en-us/create/functions/uninstall-chocolateyzippackage | ||
#Uninstall-ChocolateyEnvironmentVariable - https://docs.chocolatey.org/en-us/create/functions/uninstall-chocolateyenvironmentvariable | ||
#Uninstall-BinFile # Only needed if you used Install-BinFile - see https://docs.chocolatey.org/en-us/create/functions/uninstall-binfile | ||
## Remove any shortcuts you added in the install script. | ||
|