Skip to content

Commit

Permalink
Create Package profile
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
tunisiano187 committed May 14, 2024
1 parent d02b928 commit 8ffe1ad
Show file tree
Hide file tree
Showing 8 changed files with 486 additions and 0 deletions.
10 changes: 10 additions & 0 deletions automatic/profile/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[![](https://img.shields.io/chocolatey/v/profile?color=green&label=profile)](https://chocolatey.org/packages/profile) [![](https://img.shields.io/chocolatey/dt/profile)](https://chocolatey.org/packages/profile)

## PKGTITLE

PKGDesc

### Package-specific issue
If this package isn't up-to-date for some days, [Create an issue](https://github.com/tunisiano187/Chocolatey-packages/issues/new/choose)

Support the package maintainer and [![Patreon](https://cdn.jsdelivr.net/gh/tunisiano187/Chocolatey-packages@d15c4e19c709e7148588d4523ffc6dd3cd3c7e5e/icons/patreon.png)](https://www.patreon.com/tunisiano)
131 changes: 131 additions & 0 deletions automatic/profile/_TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
TODO

1. Determine Package Use:

Organization? Internal Use? - You are not subject to distribution
rights when you keep everything internal. Put the binaries directly
into the tools directory (as long as total nupkg size is under 1GB).
When bigger, look to use from a share or download binaries from an
internal location. Embedded binaries makes for the most reliable use
of Chocolatey. Use `$fileLocation` (`$file`/`$file64`) and
`Install-ChocolateyInstallPackage`/`Get-ChocolateyUnzip` in
tools\chocolateyInstall.ps1.

You can also choose to download from internal urls, see the next
section, but ignore whether you have distribution rights or not, it
doesn't apply. Under no circumstances should download from the
internet, it is completely unreliable. See
https://docs.chocolatey.org/en-us/community-repository/community-packages-disclaimer
to understand the limitations of a publicly available repository.

Community Repository?
Have Distribution Rights?
If you are the software vendor OR the software EXPLICITLY allows
redistribution and the total nupkg size will be under 200MB, you
have the option to embed the binaries directly into the package to
provide the most reliable install experience. Put the binaries
directly into the tools folder, use `$fileLocation` (`$file`/
`$file64`) and `Install-ChocolateyInstallPackage`/
`Get-ChocolateyUnzip` in tools\chocolateyInstall.ps1. Additionally,
fill out the LICENSE and VERIFICATION file (see 3 below and those
files for specifics).

NOTE: You can choose to download binaries at runtime, but be sure
the download location will remain stable. See the next section.

Do Not Have Distribution Rights?
- Note: Packages built this way cannot be 100% reliable, but it's a
constraint of publicly available packages and there is little
that can be done to change that. See
https://docs.chocolatey.org/en-us/community-repository/community-packages-disclaimer
to better understand the limitations of a publicly available
repository.
Download Location is Publicly Available?
You will need to download the runtime files from their official
location at runtime. Use `$url`/`$url64` and
`Install-ChocolateyPackage`/`Install-ChocolateyZipPackage` in
tools\chocolateyInstall.ps1.
Download Location is Not Publicly Available?
Stop here, you can't push this to the community repository. You
can ask the vendor for permission to embed, then include a PDF of
that signed permission directly in the package. Otherwise you
will need to seek alternate locations to non-publicly host the
package.
Download Location Is Same For All Versions?
You still need to point to those urls, but you may wish to set up
something like Automatic Updater (AU) so that when a new version
of the software becomes available, the new package version
automatically gets pushed up to the community repository. See
https://docs.chocolatey.org/en-us/create/automatic-packages#automatic-updater-au

2. Determine Package Type:

- Installer Package - contains an installer (everything in template is
geared towards this type of package)
- Zip Package - downloads or embeds and unpacks archives, may unpack
and run an installer using `Install-ChocolateyInstallPackage` as a
secondary step.
- Portable Package - Contains runtime binaries (or unpacks them as a
zip package) - cannot require administrative permissions to install
or use
- Config Package - sets config like files, registry keys, etc
- Extension Package - Packages that add PowerShell functions to
Chocolatey - https://docs.chocolatey.org/en-us/features/extensions
- Template Package - Packages that add templates like this for `choco
new -t=name` - https://docs.chocolatey.org/en-us/guides/create/create-custom-package-templates
- Other - there are other types of packages as well, these are the main
package types seen in the wild

3. Fill out the package contents:

- tools\chocolateyBeforeModify.ps1 - remove if you have no processes
or services to shut down before upgrade/uninstall
- tools\LICENSE.txt / tools\VERIFICATION.txt - Remove if you are not
embedding binaries. Keep and fill out if you are embedding binaries
in the package AND pushing to the community repository, even if you
are the author of software. The file becomes easier to fill out
(does not require changes each version) if you are the software
vendor. If you are building packages for internal use (organization,
etc), you don't need these files as you are not subject to
distribution rights internally.
- tools\chocolateyUninstall.ps1 - remove if autouninstaller can
automatically uninstall and you have nothing additional to do during
uninstall
- Readme.txt - delete this file once you have read over and used
anything you've needed from here
- nuspec - fill this out, then clean out all the comments (you may wish
to leave the headers for the package vs software metadata)
- tools\chocolateyInstall.ps1 - instructions in next section.

4. ChocolateyInstall.ps1:

- For embedded binaries - use `$fileLocation` (`$file`/`$file64`) and
`Install-ChocolateyInstallPackage`/ `Get-ChocolateyUnzip`.
- Downloading binaries at runtime - use `$url`/`$url64` and
`Install-ChocolateyPackage` / `Install-ChocolateyZipPackage`.
- Other needs (creating files, setting registry keys), use regular
PowerShell to do so or see if there is a function already defined:
https://docs.chocolatey.org/en-us/create/functions
- There may also be functions available in extension packages, see
https://community.chocolatey.org/packages?q=id%3A.extension for examples and
availability.
- Clean out the comments and sections you are not using.

5. Test the package to ensure install/uninstall work appropriately.
There is a test environment you can use for this -
https://github.com/chocolatey/chocolatey-test-environment

6. Learn more about Chocolatey packaging - go through the workshop at
https://github.com/chocolatey/chocolatey-workshop
You will learn about
- General packaging
- Customizing package behavior at runtime (package parameters)
- Extension packages
- Custom packaging templates
- Setting up an internal Chocolatey.Server repository
- Adding and using internal repositories
- Reporting
- Advanced packaging techniques when installers are not friendly to
automation

7. Delete this file.
83 changes: 83 additions & 0 deletions automatic/profile/profile.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Read this before creating packages: https://docs.chocolatey.org/en-us/create/create-packages -->
<!-- It is especially important to read the above link to understand additional requirements when publishing packages to the community feed aka dot org (https://community.chocolatey.org/packages). -->

<!-- Test your packages in a test environment: https://github.com/chocolatey/chocolatey-test-environment -->

<!--
This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Reference. Chocolatey uses a special version of NuGet.Core that allows us to do more than was initially possible. As such there are certain things to be aware of:
* the package xmlns schema url may cause issues with nuget.exe
* Any of the following elements can ONLY be used by choco tools - projectSourceUrl, docsUrl, mailingListUrl, bugTrackerUrl, packageSourceUrl, provides, conflicts, replaces
* nuget.exe can still install packages with those elements but they are ignored. Any authoring tools or commands will error on those elements
-->

<!-- You can embed software files directly into packages, as long as you are not bound by distribution rights. -->
<!-- * If you are an organization making private packages, you probably have no issues here -->
<!-- * If you are releasing to the community feed, you need to consider distribution rights. -->
<!-- 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>
<!-- == PACKAGE SPECIFIC SECTION == -->
<!-- This section is about this package, although id and version have ties back to the software -->
<!-- id is lowercase and if you want a good separator for words, use '-', not '.'. Dots are only acceptable as suffixes for certain types of packages, e.g. .install, .portable, .extension, .template -->
<!-- If the software is cross-platform, attempt to use the same id as the debian/rpm package(s) if possible. -->
<id>profile</id>
<!-- version should MATCH as closely as possible with the underlying software -->
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
<version>0.0</version>
<!-- <packageSourceUrl>Where is this Chocolatey package located (think GitHub)? packageSourceUrl is highly recommended for the community feed</packageSourceUrl>-->
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
<!--<owners>tunisiano</owners>-->
<!-- ============================== -->

<!-- == SOFTWARE SPECIFIC SECTION == -->
<!-- This section is about the software itself -->
<title>profile (Install)</title>
<authors>__REPLACE_AUTHORS_OF_SOFTWARE_COMMA_SEPARATED__</authors>
<!-- projectUrl is required for the community feed -->
<projectUrl>https://_Software_Location_REMOVE_OR_FILL_OUT_</projectUrl>
<!-- There are a number of CDN Services that can be used for hosting the Icon for a package. More information can be found here: https://docs.chocolatey.org/en-us/create/create-packages#package-icon-guidelines -->
<!-- Here is an example using Githack -->
<!--<iconUrl>http://rawcdn.githack.com/__REPLACE_YOUR_REPO__/master/icons/profile.png</iconUrl>-->
<!-- <copyright>Year Software Vendor</copyright> -->
<!-- If there is a license Url available, it is required for the community feed -->
<!-- <licenseUrl>Software License Location __REMOVE_OR_FILL_OUT__</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>-->
<!--<projectSourceUrl>Software Source Location - is the software FOSS somewhere? Link to it with this</projectSourceUrl>-->
<!--<docsUrl>At what url are the software docs located?</docsUrl>-->
<!--<mailingListUrl></mailingListUrl>-->
<!--<bugTrackerUrl></bugTrackerUrl>-->
<tags>profile SPACE_SEPARATED</tags>
<summary>__REPLACE__</summary>
<description>__REPLACE__MarkDown_Okay


**Please Note**: This is an automatically updated package. If you find it is
out of date by more than a day or two, please contact the maintainer(s) and
let them know the package is no longer updating correctly.
</description>
<!-- <releaseNotes>__REPLACE_OR_REMOVE__MarkDown_Okay</releaseNotes> -->
<!-- =============================== -->

<!-- Specifying dependencies and version ranges? https://docs.nuget.org/create/versioning#specifying-version-ranges-in-.nuspec-files -->
<!--<dependencies>
<dependency id="" version="__MINIMUM_VERSION__" />
<dependency id="" version="[__EXACT_VERSION__]" />
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_INCLUSIVE]" />
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_EXCLUSIVE)" />
<dependency id="" />
<dependency id="chocolatey-core.extension" version="1.1.0" />
</dependencies>-->
<!-- chocolatey-core.extension - https://community.chocolatey.org/packages/chocolatey-core.extension -->

<!--<provides>NOT YET IMPLEMENTED</provides>-->
<!--<conflicts>NOT YET IMPLEMENTED</conflicts>-->
<!--<replaces>NOT YET IMPLEMENTED</replaces>-->
</metadata>
<files>
<!-- this section controls what actually gets packaged into the Chocolatey package -->
<file src="tools\**" target="tools" />
</files>
</package>
11 changes: 11 additions & 0 deletions automatic/profile/tools/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

Note: Include this file if including binaries you have the right to distribute.
Otherwise delete. this file.

===DELETE ABOVE THIS LINE AND THIS LINE===

From: <insert applicable license url here>

LICENSE

<Insert License Here>
13 changes: 13 additions & 0 deletions automatic/profile/tools/VERIFICATION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Note: Include this file if including binaries you have the right to distribute.
Otherwise delete. this file. If you are the software author, you can mention
this.

===DELETE ABOVE THIS LINE AND THIS LINE===

VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

<Include details of how to verify checksum contents>
<If software vendor, explain that here>
9 changes: 9 additions & 0 deletions automatic/profile/tools/chocolateybeforemodify.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This runs before upgrade or uninstall.
# Use this file to do things like stop services prior to upgrade or uninstall.
# NOTE: It is an anti-pattern to call chocolateyUninstall.ps1 from here. If you
# need to uninstall an MSI prior to upgrade, put the functionality in this
# file without calling the uninstall script. Make it idempotent in the
# uninstall script so that it doesn't fail when it is already uninstalled.
# NOTE: For upgrades - like the uninstall script, this script always runs from
# the currently installed version, not from the new upgraded package version.

Loading

0 comments on commit 8ffe1ad

Please sign in to comment.