You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: installer/github_release_installer.go
+75-5Lines changed: 75 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,17 @@ type GitHubReleaseOpts struct {
60
60
// a symlink at Target pointing to Source; on Windows, the file is copied instead (since
61
61
// symlinks require elevated privileges). Only meaningful with ExtractTo.
62
62
BinLinks []GitHubReleaseBinLink
63
+
// ExtractCommand is a user-provided shell command that performs the extraction when
64
+
// Strategy is "custom". The command is run through Go template substitution with these
65
+
// extra variables available (in addition to the usual .OS, .Arch, .Tag, ...):
66
+
// {{ .DownloadFile }} - absolute path to the downloaded asset
67
+
// {{ .ExtractDir }} - temp directory where the command should place extracted files
68
+
// {{ .Destination }} - final destination directory
69
+
// {{ .BinName }} - expected binary name (matches GetBinName())
70
+
// {{ .ArchiveBinName }} - the filename sofmani will copy from ExtractDir to Destination
71
+
// After the command finishes, sofmani copies ExtractDir/ArchiveBinName to
72
+
// Destination/BinName, the same way the tar and zip strategies do.
73
+
ExtractCommand*string
63
74
}
64
75
65
76
// GitHubReleaseBinLink describes a single binary exposed from a tree-mode install.
@@ -76,10 +87,11 @@ type GitHubReleaseInstallStrategy string
76
87
77
88
// Constants for GitHub release installation strategies.
78
89
const (
79
-
GitHubReleaseInstallStrategyNoneGitHubReleaseInstallStrategy="none"// GitHubReleaseInstallStrategyNone means no special handling, just download the file.
80
-
GitHubReleaseInstallStrategyTarGitHubReleaseInstallStrategy="tar"// GitHubReleaseInstallStrategyTar means extract a tar archive.
81
-
GitHubReleaseInstallStrategyZipGitHubReleaseInstallStrategy="zip"// GitHubReleaseInstallStrategyZip means extract a zip archive.
82
-
GitHubReleaseInstallStrategyGzipGitHubReleaseInstallStrategy="gzip"// GitHubReleaseInstallStrategyGzip means decompress a single gzip-compressed file (not a tar archive).
90
+
GitHubReleaseInstallStrategyNoneGitHubReleaseInstallStrategy="none"// GitHubReleaseInstallStrategyNone means no special handling, just download the file.
91
+
GitHubReleaseInstallStrategyTarGitHubReleaseInstallStrategy="tar"// GitHubReleaseInstallStrategyTar means extract a tar archive.
92
+
GitHubReleaseInstallStrategyZipGitHubReleaseInstallStrategy="zip"// GitHubReleaseInstallStrategyZip means extract a zip archive.
93
+
GitHubReleaseInstallStrategyGzipGitHubReleaseInstallStrategy="gzip"// GitHubReleaseInstallStrategyGzip means decompress a single gzip-compressed file (not a tar archive).
94
+
GitHubReleaseInstallStrategyCustomGitHubReleaseInstallStrategy="custom"// GitHubReleaseInstallStrategyCustom runs a user-provided shell command to extract the asset.
83
95
)
84
96
85
97
// Validate validates the installer configuration.
@@ -107,12 +119,22 @@ func (i *GitHubReleaseInstaller) Validate() []ValidationError {
"description": "How to handle the downloaded asset. 'none' copies it directly; 'tar' and 'zip' extract an archive; 'gzip' (alias 'gz') decompresses a single gzip-compressed file (not a tarball)."
309
+
"description": "How to handle the downloaded asset. 'none' copies it directly; 'tar' and 'zip' extract an archive; 'gzip' (alias 'gz') decompresses a single gzip-compressed file (not a tarball); 'custom' runs opts.extract_command as a user-supplied hook."
310
+
},
311
+
"extract_command": {
312
+
"type": "string",
313
+
"description": "Shell command to run when strategy is 'custom'. Supports Go template variables — in addition to the usual {{ .OS }}, {{ .Arch }}, {{ .Tag }}, etc., the following extract-specific variables are available: {{ .DownloadFile }}, {{ .ExtractDir }}, {{ .Destination }}, {{ .BinName }}, {{ .ArchiveBinName }}. After the command finishes, sofmani copies {{ .ExtractDir }}/{{ .ArchiveBinName }} to {{ .Destination }}/{{ .BinName }}."
310
314
},
311
315
"download_filename": {
312
316
"description": "Asset filename, or a per-platform map. Supports Go template variables.",
0 commit comments