Chocolatey:制作安装脚本
Chocolatey: Make an install script
为了制作安装脚本和了解现有的脚本,我想知道典型的幕后发生了什么:
choco install notepadplusplus
我找到了以下 here:
Installation
- Chocolatey uses Nuget.Core to retrieve the package from the source.
- Choco determines if it self-contained or has automation scripts - PowerShell scripts (*.ps1 files), and soon to be open to Scriptcs files in the 0.9.10.x timeframe (I know, right?!).
- Choco takes a registry snapshot for later comparison.
- If there are automation scripts, choco will run those. They can contain whatever you need to do, if they are PowerShell you have the full power of Posh (PowerShell), but you should try to ensure they are compatible with Posh v2+.
- Choco compares the snapshot and determines uninstaller information and saves that to a .registry file.
- Choco snapshots the folder based on all files that are currently in the package directory.
- Choco looks for executable files in the package folder and generates shims into the $env:ChocolateyInstall\bin folder so those items are available on the path. Those could have been embedded into the package or brought down from somewhere (internet, ftp, file folder share, etc) and placed there.
鉴于此,
如何获得.nupkg
包URL?一般来说,它看起来像这样:
.nupkg
包下载目录是哪个?
默认提取的.nupkg
包内容在哪里?这很重要,因为 chocolateyInstall.ps1
有时会使用 Split-Path -Parent $MyInvocation.MyCommand.Definition
.
"Scriptcs files in the 0.9.10.x timeframe" 相当神秘。能给点参考吗?
Posh v2+ 是 Powershell 的简称还是一种特定的技术?
$env:ChocolateyInstall\lib
中有几个可执行文件,$env:ChocolateyInstall\bin
中没有 link。比如mpv播放器的mpv.exe
就没有linked。
- 是的,下载 URL 似乎是正确的。下载目录始终在 Chocolatey 安装文件夹中,然后是
lib\packageName
,这是内容提取到的位置。
- 目前,安装脚本仅使用 PowerShell 编写。此评论指的是使用 ScriptCS 运行 时间在 C# 中编写安装脚本的能力。目前尚不支持此功能。
- 是的,这只是引用 PowerShell 的一种简短方式。
- 对于 mpv 包,您会注意到有一个
mpv.exe.ignore
文件。包中存在此文件会阻止创建 shim。
为了制作安装脚本和了解现有的脚本,我想知道典型的幕后发生了什么:
choco install notepadplusplus
我找到了以下 here:
Installation
- Chocolatey uses Nuget.Core to retrieve the package from the source.
- Choco determines if it self-contained or has automation scripts - PowerShell scripts (*.ps1 files), and soon to be open to Scriptcs files in the 0.9.10.x timeframe (I know, right?!).
- Choco takes a registry snapshot for later comparison.
- If there are automation scripts, choco will run those. They can contain whatever you need to do, if they are PowerShell you have the full power of Posh (PowerShell), but you should try to ensure they are compatible with Posh v2+.
- Choco compares the snapshot and determines uninstaller information and saves that to a .registry file.
- Choco snapshots the folder based on all files that are currently in the package directory.
- Choco looks for executable files in the package folder and generates shims into the $env:ChocolateyInstall\bin folder so those items are available on the path. Those could have been embedded into the package or brought down from somewhere (internet, ftp, file folder share, etc) and placed there.
鉴于此,
如何获得
.nupkg
包URL?一般来说,它看起来像这样:.nupkg
包下载目录是哪个?默认提取的
.nupkg
包内容在哪里?这很重要,因为chocolateyInstall.ps1
有时会使用Split-Path -Parent $MyInvocation.MyCommand.Definition
.
"Scriptcs files in the 0.9.10.x timeframe" 相当神秘。能给点参考吗?
Posh v2+ 是 Powershell 的简称还是一种特定的技术?
$env:ChocolateyInstall\lib
中有几个可执行文件,$env:ChocolateyInstall\bin
中没有 link。比如mpv播放器的mpv.exe
就没有linked。
- 是的,下载 URL 似乎是正确的。下载目录始终在 Chocolatey 安装文件夹中,然后是
lib\packageName
,这是内容提取到的位置。 - 目前,安装脚本仅使用 PowerShell 编写。此评论指的是使用 ScriptCS 运行 时间在 C# 中编写安装脚本的能力。目前尚不支持此功能。
- 是的,这只是引用 PowerShell 的一种简短方式。
- 对于 mpv 包,您会注意到有一个
mpv.exe.ignore
文件。包中存在此文件会阻止创建 shim。