mirror of
https://github.com/getlantern/elevate
synced 2025-12-24 12:11:57 +08:00
updated to embed binaries and use new universal, signed binary on mac
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,15 +1,18 @@
|
||||
package elevate
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/getlantern/byteexec"
|
||||
"github.com/getlantern/elevate/bin"
|
||||
)
|
||||
|
||||
//go:embed binaries/osx/cocoasudo
|
||||
var cocoasudo []byte
|
||||
|
||||
func buildCommand(prompt string, icon string, name string, args ...string) (*exec.Cmd, error) {
|
||||
argsLen := len(args)
|
||||
if icon != "" {
|
||||
@@ -27,14 +30,10 @@ func buildCommand(prompt string, icon string, name string, args ...string) (*exe
|
||||
}
|
||||
allArgs = append(allArgs, name)
|
||||
allArgs = append(allArgs, args...)
|
||||
cocoasudo, err := bin.Asset("cocoasudo")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to load cocoasudo: %v", err)
|
||||
}
|
||||
_, program := filepath.Split(os.Args[0])
|
||||
be, err := byteexec.New(cocoasudo, program)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to build byteexec for cocoasudo: %v", err)
|
||||
return nil, fmt.Errorf("unable to build byteexec for cocoasudo: %v", err)
|
||||
}
|
||||
|
||||
return be.Command(allArgs...), nil
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package elevate
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -10,6 +11,9 @@ import (
|
||||
"github.com/getlantern/elevate/bin"
|
||||
)
|
||||
|
||||
//go:embed binaries/windows/elevate.exe
|
||||
var cocoasudo []byte
|
||||
|
||||
func buildCommand(prompt string, icon string, name string, args ...string) (*exec.Cmd, error) {
|
||||
argsLen := len(args)
|
||||
if icon != "" {
|
||||
@@ -22,10 +26,6 @@ func buildCommand(prompt string, icon string, name string, args ...string) (*exe
|
||||
allArgs = append(allArgs, "-w") // wait for termination
|
||||
allArgs = append(allArgs, name)
|
||||
allArgs = append(allArgs, args...)
|
||||
cocoasudo, err := bin.Asset("elevate.exe")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to load elevate.exe: %v", err)
|
||||
}
|
||||
_, program := filepath.Split(os.Args[0])
|
||||
be, err := byteexec.New(cocoasudo, program)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@@ -7,8 +7,10 @@
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
function die() {
|
||||
echo $*
|
||||
echo "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -18,9 +20,5 @@ then
|
||||
fi
|
||||
|
||||
osslsigncode sign -pkcs12 "$BNS_CERT" -pass "$BNS_CERT_PASS" -in binaries/windows_unsigned/elevate_unsigned.exe -out binaries/windows/elevate.exe || die "Could not sign windows"
|
||||
codesign -s "Developer ID Application: Brave New Software Project, Inc" -f binaries/osx/cocoasudo || die "Could not sign macintosh"
|
||||
|
||||
go-bindata -nomemcopy -nocompress -pkg bin -prefix binaries/osx -o bin/cocoasudo_darwin.go binaries/osx
|
||||
#go-bindata -nomemcopy -nocompress -pkg bin -prefix binaries/linux_386 -o natty/bin/linux_386.go binaries/linux_386
|
||||
#go-bindata -nomemcopy -nocompress -pkg bin -prefix binaries/linux_amd64 -o natty/bin/linux_amd64.go binaries/linux_amd64
|
||||
go-bindata -nomemcopy -nocompress -pkg bin -prefix binaries/windows -o bin/elevate_windows.go binaries/windows
|
||||
#codesign -s "Developer ID Application: Brave New Software Project, Inc" -f binaries/osx/cocoasudo || die "Could not sign macintosh"
|
||||
codesign --options runtime --strict --timestamp --force --deep -r="designated => anchor trusted and identifier com.getlantern.lantern" -s "Developer ID Application: Innovate Labs LLC (4FYC28AXA2)" -v binaries/osx/cocoasudo
|
||||
|
||||
Reference in New Issue
Block a user