Chocolatey: Пример создания пакета .nupkg
На примере bareos-client.
Описание программы и общие сведения в файле bareos-client.nuspec:
Описание программы и общие сведения в файле bareos-client.nuspec:
<?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/2010/07/nuspec.xsd">
<metadata>
<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
<id>bareos-client</id>
<title>Winbareos</title>
<version>19.2.7</version>
<packageSourceUrl>https://github.com/sovamakarosh/chocolatey/tree/master/bareos-client</packageSourceUrl>
<authors>Bareos GmbH and Co.KG</authors>
<owners>Slava Makarov</owners>
<summary>Backup</summary>
<description>Bareos is a 100% open source fork of the backup project from bacula.org.
The fork is in development since late 2010, it has a lot of new features.
The source has been published on github, licensed AGPLv3.</description>
<projectUrl>https://www.bareos.org/en/</projectUrl>
<projectSourceUrl>https://www.bareos.org/en/open-source.html</projectSourceUrl>
<docsUrl>https://www.bareos.org/en/documentation.html</docsUrl>
<mailingListUrl>https://www.bareos.org/en/howto-contribute.html#mailinglists</mailingListUrl>
<bugTrackerUrl>https://bugs.bareos.org/my_view_page.php</bugTrackerUrl>
<tags>bareos winbareos admin backup windows</tags>
<copyright>© Copyright Bareos GmbH and Co. KG. Bareos is a registered Trademark of Bareos GmbH and Co. KG.</copyright>
<licenseUrl>https://docs.bareos.org/Appendix/BareosCopyrightTrademarkAndLicenses.html</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<!-- Important note about https://cdn.rawgit.com: Files are cached permanently after the first request. Use commit URLs when updating the icon. -->
<iconUrl>https://raw.github.com/C-Duv/chocolatey-winbareos/master/winbareos/winbareos-logo.png</iconUrl>
<!--<dependencies>
<dependency id="" version="" />
</dependencies>-->
<releaseNotes>32bit, 64bit.</releaseNotes>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
Описание процесса установки chocolateyInstall.ps1:
$packageName = 'bareos-client'
$installerType = 'exe'
$url = 'https://download.bareos.org/bareos/release/19.2/windows/winbareos-19.2.7-release-32-bit.exe'
$url64 = 'https://download.bareos.org/bareos/release/19.2/windows/winbareos-19.2.7-release-64-bit.exe'
$silentArgs = '/S'
$validExitCodes = @(0)
$checksum = '3CA9FE7BC67DC042F9F97AB448F05A733502833BFCADE3B26CCEF900545E7FAF'
$checksumType = 'sha256'
$checksum64 = 'D2880A6110C7A1A42AED7BB97F0BCB176F58427223EFF1C305A183382CFC1055'
$checksumType64= 'sha256'
Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" "$url64" "$checksum" "$checksumType" "$checksum64" "$checksumType64" -validExitCodes $validExitCodes
Если надо получить md5 хеш (PowerShell):Get-FileHash -Path '.\winbareos.msi' -Algorithm SHA256
Пакуем в .nupkg:cpack -y
Пробная установка из локального пакета:cinst -fvy .\bareos-client.19.2.7.nupkg
Если всё ок, пушим в репозиторий:choco push .\bareos-client.19.2.7.nupkg --source https://push.chocolatey.org/
Похожие публикации
Chocolatey: Локальный репозиторий
Jetware: автоматизация конфигурации сервера
Нет комментариев