
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin cinst warmup cinst git cinst nuget.commandline cd %ChocolateyInstall% git clone https://github.com/chocolatey/chocolateytemplates.git cd chocolateytemplates\_templates warmup addTextReplacement __CHOCO_PKG_OWNER_NAME__ "Your Name" warmup addTextReplacement __CHOCO_PKG_OWNER_REPO__ "Your Repository" C:\CODE\_templates I don’t like it, that's why I change it to my own. If you agree with me on this issue, then open the config file that is stored here:c:\Chocolatey\lib\warmup.*\bin\warmup.exe.Config we find C:\CODE\_templates and change it to our directory.%ChocolateyInstall%\chocolateytemplates\_templates execute the command (I run only from under admin ): warmup addTemplateFolder chocolatey "%CD%\chocolatey" packages
| - workrave
| - src
| - tools
| - workrave.nuspec
| - ... ..
| - build
| - package-2
packages directory we execute: warmup chocolatey workrave workrave folder that workrave create a src and transfer the contents of the workrave .workrave.nuspec . This is the usual xml , with the description of our package. The name of the tags speaks for itself: title - the name of the program, which will be displayed in the list of packages on the website chocolatey.org; author is the creator of the program you are putting into the package ....tools\chocolateyInstall.ps1 #NOTE: Please remove any commented lines to tidy up prior to releasing the package, including this one $packageName = 'workrave' # arbitrary name for the package, used in messages $installerType = 'EXE_MSI_OR_MSU' #only one of these: exe, msi, msu $url = 'URL_HERE' # download url $url64 = 'URL_x64_HERE' # 64bit URL here or remove - if installer decides, then use $url $silentArgs = 'SILENT_ARGS_HERE' # "/s /S /q /Q /quiet /silent /SILENT /VERYSILENT" # try any of these to get the silent installer #msi is always /quiet $validExitCodes = @(0) #please insert other valid exit codes here, exit codes for ms http://msdn.microsoft.com/en-us/library/aa368542(VS.85).aspx # main helpers - these have error handling tucked into them already # installer, will assert administrative rights # if removing $url64, please remove from here Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" "$url64" -validExitCodes $validExitCodes # download and unpack a zip file # if removing $url64, please remove from here Install-ChocolateyZipPackage "$packageName" "$url" "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" "$url64" #try { #error handling is only necessary if you need to do anything in addition to/instead of the main helpers # other helpers - using any of these means you want to uncomment the error handling up top and at bottom. # downloader that the main helpers use to download items # if removing $url64, please remove from here #Get-ChocolateyWebFile "$packageName" 'DOWNLOAD_TO_FILE_FULL_PATH' "$url" "$url64" # installer, will assert administrative rights - used by Install-ChocolateyPackage #Install-ChocolateyInstallPackage "$packageName" "$installerType" "$silentArgs" '_FULLFILEPATH_' -validExitCodes $validExitCodes # unzips a file to the specified location - auto overwrites existing content #Get-ChocolateyUnzip "FULL_LOCATION_TO_ZIP.zip" "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" # Runs processes asserting UAC, will assert administrative rights - used by Install-ChocolateyInstallPackage #Start-ChocolateyProcessAsAdmin 'STATEMENTS_TO_RUN' 'Optional_Application_If_Not_PowerShell' -validExitCodes $validExitCodes # add specific folders to the path - any executables found in the chocolatey package folder will already be on the path. This is used in addition to that or for cases when a native installer doesn't add things to the path. #Install-ChocolateyPath 'LOCATION_TO_ADD_TO_PATH' 'User_OR_Machine' # Machine will assert administrative rights # add specific files as shortcuts to the desktop #$target = Join-Path $MyInvocation.MyCommand.Definition "$($packageName).exe" #Install-ChocolateyDesktopLink $target #------- ADDITIONAL SETUP -------# # make sure to uncomment the error handling if you have additional setup to do #$processor = Get-WmiObject Win32_Processor #$is64bit = $processor.AddressWidth -eq 64 # the following is all part of error handling #Write-ChocolateySuccess "$packageName" #} catch { #Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)" #throw #} Install-ChocolateyPackage - downloads exe file and runs its installation with the necessary keys. The most running team in most cases it should be enough. Install-ChocolateyZipPackage - downloads a zip archive and unpacks it into the specified directory.try / catch is in case of a complicated installation process. Say download zip archive, unzip and run .exe file from it. #NOTE: Please remove any commented lines to tidy up prior to releasing the package, including this one $packageName = 'workrave' # arbitrary name for the package, used in messages $installerType = 'exe' #only one of these: exe, msi, msu $url = 'http://softlayer-ams.dl.sourceforge.net/project/workrave/workrave/1.10.1/workrave-win32-v1.10.1-installer.exe' # download url $silentArgs = '/verysilent /norestart' # "/s /S /q /Q /quiet /silent /SILENT /VERYSILENT" # try any of these to get the silent installer #msi is always /quiet $validExitCodes = @(0) #please insert other valid exit codes here, exit codes for ms http://msdn.microsoft.com/en-us/library/aa368542(VS.85).aspx # main helpers - these have error handling tucked into them already # installer, will assert administrative rights # if removing $url64, please remove from here Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" -validExitCodes $validExitCodes # download and unpack a zip file /verysilent /norestart keys for silent installation. The list of the most common keys in public installers is given in the description of the $silentArgs variable. You can also read this: unattended.sourceforge.net/installers.phpSource: https://habr.com/ru/post/223373/
All Articles