mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 07:12:27 +00:00
build: Generalize code signing
Should, at the least, also codesign when building zip for mac.
This commit is contained in:
parent
eca156fd7f
commit
d8e7e92512
19
build.go
19
build.go
@ -489,10 +489,7 @@ func buildTar(target target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build(target, tags)
|
build(target, tags)
|
||||||
|
codesign(target)
|
||||||
if goos == "darwin" {
|
|
||||||
macosCodesign(target.BinaryName())
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := range target.archiveFiles {
|
for i := range target.archiveFiles {
|
||||||
target.archiveFiles[i].src = strings.Replace(target.archiveFiles[i].src, "{{binary}}", target.BinaryName(), 1)
|
target.archiveFiles[i].src = strings.Replace(target.archiveFiles[i].src, "{{binary}}", target.BinaryName(), 1)
|
||||||
@ -515,10 +512,7 @@ func buildZip(target target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build(target, tags)
|
build(target, tags)
|
||||||
|
codesign(target)
|
||||||
if goos == "windows" {
|
|
||||||
windowsCodesign(target.BinaryName())
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := range target.archiveFiles {
|
for i := range target.archiveFiles {
|
||||||
target.archiveFiles[i].src = strings.Replace(target.archiveFiles[i].src, "{{binary}}", target.BinaryName(), 1)
|
target.archiveFiles[i].src = strings.Replace(target.archiveFiles[i].src, "{{binary}}", target.BinaryName(), 1)
|
||||||
@ -1179,6 +1173,15 @@ func zipFile(out string, files []archiveFile) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func codesign(target target) {
|
||||||
|
switch goos {
|
||||||
|
case "windows":
|
||||||
|
windowsCodesign(target.BinaryName())
|
||||||
|
case "darwin":
|
||||||
|
macosCodesign(target.BinaryName())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func macosCodesign(file string) {
|
func macosCodesign(file string) {
|
||||||
if pass := os.Getenv("CODESIGN_KEYCHAIN_PASS"); pass != "" {
|
if pass := os.Getenv("CODESIGN_KEYCHAIN_PASS"); pass != "" {
|
||||||
bs, err := runError("security", "unlock-keychain", "-p", pass)
|
bs, err := runError("security", "unlock-keychain", "-p", pass)
|
||||||
|
Loading…
Reference in New Issue
Block a user