Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PSADT template #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

steviecoaster
Copy link

@steviecoaster steviecoaster commented Feb 1, 2023

The PSAppDeployToolkit is a great framework for generating deployable executables with silent arguments.

You can leverage these PSADT applications in Chocolatey packages if you zip them up and distribute them. This template helps a user create a Chocolatey package for PSADT applications.

Related: #5

∙
∙ This change adds a template for generating Chocolatey packages
∙ from a PSADT application.
∙
∙ PSAppDeployToolkit is a framework for generating an executable with
∙ silent installation parameters via PowerShell.
statements = "-DeploymentType 'Uninstall' -DeployMode 'Silent'"
}

Start-ChocolateyProcessAsAdmin @packageArgs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest switching to Uninstall-ChocolateyPackage if possible, as that has support for valid exit codes.

$destination = (Join-Path $toolsDir -ChildPath $env:ChocolateyPackageName)


$adtExe = Join-Path $destination -ChildPath "Deploy-Application.exe"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this deploy-application.exe needed to be excluded from the package reducer?

<!-- 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>psadt-silent.template</id>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all Chocolatey packages should be silent, this could be simplified to psadt.template

<version>1.0.0</version>
<packageSourceUrl>https://github.com/chocolatey-community/chocolatey-templates/tree/main/src/psadt-silent.template</packageSourceUrl>
<owners>Stephen Valdinger, Chocolatey-Community</owners>
<title>PSADT Template</title>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<title>PSADT Template</title>
<title>PSAppDeployToolkit Template</title>


Install-ChocolateyInstallPackage @packageArgs
} catch {
$packageArgs = @{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason this catch block is needed? It seems to be doing pretty much the same thing as the try block.

$zipArchive = Join-Path $toolsDir -ChildPath '[[Zip]]'
$destination = (Join-Path $toolsDir -ChildPath $env:ChocolateyPackageName)

Get-ChocolateyUnzip -FileFullPath $zipArchive -Destination $destination
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the zip archive is embedded, it is probably best to include the license and verification template files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants