Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac installer #889

Merged
merged 57 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
aecb284
Merge remote-tracking branch 'upstream/develop' into develop
alexadhy Sep 21, 2021
822ca01
macos installer
alexadhy Sep 23, 2021
cc3c681
fixes install and run
alexadhy Sep 23, 2021
fac1cf2
added installation package for arm64 / m1
alexadhy Sep 23, 2021
38caf2d
fixes create_installer
alexadhy Sep 23, 2021
363561a
add arm64 to Distribution
alexadhy Sep 23, 2021
6796436
fixes update
alexadhy Sep 23, 2021
0871f45
changes directory to defaults in macOS
alexadhy Sep 23, 2021
25b24dc
fixes icon loading, changes default confPath for skywire-visor
alexadhy Sep 23, 2021
6ba2d8f
added docs
alexadhy Sep 23, 2021
b3bfe51
formatting
alexadhy Sep 23, 2021
106b3b8
revert change to default config name
alexadhy Sep 23, 2021
9ffb369
fixes config loading
alexadhy Sep 24, 2021
49b4e88
Merge remote-tracking branch 'upstream/develop' into mac-installer
alexadhy Sep 24, 2021
4945356
more cleanup for makefile
alexadhy Sep 24, 2021
fd1e370
adds vpn link button to the systray
alexadhy Sep 27, 2021
119c50b
adds status to the url
alexadhy Sep 27, 2021
71174c1
fixes chown
alexadhy Sep 27, 2021
61e7f67
fixes arg
alexadhy Sep 28, 2021
1ad7366
scripts: remove sudo
alexadhy Sep 28, 2021
c59c2ba
privileged app
alexadhy Sep 28, 2021
f085d63
installer add vpn link
alexadhy Sep 28, 2021
68638fe
changes default directory of default apps
alexadhy Sep 28, 2021
af38109
various checks and fixes for mac installer
alexadhy Sep 28, 2021
3ffbbd4
formatting
alexadhy Sep 28, 2021
597f840
added version string
alexadhy Sep 28, 2021
71aecd1
Merge remote-tracking branch 'upstream/develop' into mac-installer
alexadhy Sep 29, 2021
f873127
launcher configs adjustment for darwin / windows
alexadhy Sep 29, 2021
62e4c52
vpn link adjustment
alexadhy Sep 29, 2021
196da31
also terminate vpn-client
alexadhy Sep 29, 2021
ca03537
fixes blurry icon
alexadhy Sep 29, 2021
ed95534
avoid showing dock icon
alexadhy Sep 29, 2021
29307b0
Update postinstall
alexadhy Sep 29, 2021
a8e4217
Update postinstall
alexadhy Sep 29, 2021
bfd4e9b
update docs
alexadhy Sep 29, 2021
cbafcb5
adds check if the user accidentally nukes the Skywire dir
alexadhy Sep 29, 2021
dabadc0
modifies vpn ui button and advanced button
alexadhy Sep 30, 2021
bf807f3
disable enable_auth
alexadhy Oct 1, 2021
ef18d89
enable signing
alexadhy Oct 1, 2021
860531a
added codesign (optional)
alexadhy Oct 1, 2021
4890b35
merge upstream, merge embedded icons
alexadhy Oct 2, 2021
520dc71
edit bundle name
alexadhy Oct 3, 2021
1410606
added check for skywireBuild.keychain
alexadhy Oct 4, 2021
ef5cce7
fixes check existence of said keychain logic
alexadhy Oct 4, 2021
26fd253
fixes keychains
alexadhy Oct 5, 2021
0d535e5
user should import the certificate from apple himself, also added col…
alexadhy Oct 7, 2021
58458bf
Merge remote-tracking branch 'upstream/develop' into mac-installer
alexadhy Oct 7, 2021
0e76f17
fixes makefile quoting
alexadhy Oct 7, 2021
4058677
uses productsign and codesign
alexadhy Oct 12, 2021
32118df
Merge remote-tracking branch 'upstream/develop' into mac-installer
alexadhy Oct 12, 2021
bd2b457
fixes colors
alexadhy Oct 12, 2021
ee13997
fixes makefile
alexadhy Oct 12, 2021
6a8d57e
Merge remote-tracking branch 'upstream/develop' into mac-installer
alexadhy Oct 15, 2021
ec1e7dd
TODO: fixes application not loading
alexadhy Oct 15, 2021
bd42eb1
fixes installer not running
alexadhy Oct 16, 2021
862f6ba
requested changes: configs, and dont' pass around visor in gui
alexadhy Oct 16, 2021
cd325bf
documentation makefile
alexadhy Oct 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ static/skywire-manager-src/dist/*
/dist-linux
/dist
Char
/scripts/mac_installer/IconsSkycoin.tar.gz
/scripts/mac_installer/icon_128x128.png
/scripts/mac_installer/icon_128x128@2x.png
/mac_build
/SkywireInstaller*.pkg
*.dmg
/scripts/mac_installer/icon.iconset/
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ build-systray: host-apps-systray bin-systray ## Install dependencies, build apps

build-static: host-apps-static bin-static ## Build apps and binaries. `go build` with ${OPTS}

installer: mac-installer ## Builds MacOS installer for skywire-visor

install-generate: ## Installs required execs for go generate.
${OPTS} go install github.com/mjibson/esc
${OPTS} go install github.com/vektra/mockery/cmd/mockery
Expand All @@ -78,9 +80,6 @@ install-static: ## Install `skywire-visor`, `skywire-cli`, `setup-node`
lint: ## Run linters. Use make install-linters first
${OPTS} golangci-lint run -c .golangci.yml ./...

lint-windows-appveyor:
C:\Users\appveyor\go\bin\golangci-lint run -c .golangci.yml ./...

test: ## Run tests
-go clean -testcache &>/dev/null
${OPTS} go test ${TEST_OPTS} ./internal/...
Expand Down Expand Up @@ -155,7 +154,7 @@ build-deploy: ## Build for deployment Docker images
${OPTS} go build ${BUILD_OPTS_DEPLOY} -o /release/apps/skysocks ./cmd/apps/skysocks
${OPTS} go build ${BUILD_OPTS_DEPLOY} -o /release/apps/skysocks-client ./cmd/apps/skysocks-client

github-release: sysroot
github-release:
goreleaser --rm-dist

build-docker: ## Build docker image
Expand All @@ -178,5 +177,8 @@ build-ui: install-deps-ui ## Builds the UI
mkdir ${MANAGER_UI_BUILT_DIR}
cp -r ${MANAGER_UI_DIR}/dist/. ${MANAGER_UI_BUILT_DIR}

mac-installer: ## Create unsigned application
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make this create a signed installer and application. Otherwise there is not much of a point to the target as we will likely only release signed installers.

./scripts/mac_installer/create_installer.sh

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
11 changes: 8 additions & 3 deletions cmd/skywire-cli/commands/visor/gen-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/sirupsen/logrus"
Expand All @@ -13,6 +14,7 @@ import (
"github.com/skycoin/skycoin/src/util/logging"
"github.com/spf13/cobra"

"github.com/skycoin/skywire/pkg/skyenv"
"github.com/skycoin/skywire/pkg/visor/visorconfig"
)

Expand Down Expand Up @@ -62,12 +64,15 @@ var genConfigCmd = &cobra.Command{

//set output for package and skybian configs
if packageConfig {
if hypervisor {
output = "/opt/skywire/skywire.json"
var configName string
if runtime.GOOS == "linux" {
configName = "skywire-visor.json"
} else {
output = "/opt/skywire/skywire-visor.json"
configName = "skywire-config.json"
}
output = filepath.Join(skyenv.PackageSkywirePath(), configName)
}

if skybianConfig {
output = "/etc/skywire-config.json"
}
Expand Down
26 changes: 12 additions & 14 deletions cmd/skywire-visor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
_ "net/http/pprof" // nolint:gosec // https://golang.org/doc/diagnostics.html#profiling
"os"
"os/exec"
"runtime"
"path/filepath"
"strings"
"sync"
"syscall"
Expand All @@ -25,6 +25,7 @@ import (
"github.com/toqueteos/webbrowser"

"github.com/skycoin/skywire/pkg/restart"
"github.com/skycoin/skywire/pkg/skyenv"
"github.com/skycoin/skywire/pkg/syslog"
"github.com/skycoin/skywire/pkg/visor"
"github.com/skycoin/skywire/pkg/visor/logstore"
Expand All @@ -50,6 +51,8 @@ var (
launchBrowser bool
stopVisorFn func() // nolint:unused
stopVisorWg sync.WaitGroup
vis *visor.Visor
visAssignChan chan bool
)

var rootCmd = &cobra.Command{
Expand All @@ -73,6 +76,8 @@ func init() {
}

func runVisor(args []string) {
var ok bool
visAssignChan = make(chan bool, 1)
log := initLogger(tag, syslogAddr)
store, hook := logstore.MakeStore(runtimeLogMaxEntries)
log.AddHook(hook)
Expand Down Expand Up @@ -128,29 +133,26 @@ func runVisor(args []string) {

conf := initConfig(log, args, confPath)

v, ok := visor.NewVisor(conf, restartCtx)
vis, ok = visor.NewVisor(conf, restartCtx)
if !ok {
log.Errorln("Failed to start visor.")
quitSystray()
return
}
v.SetLogstore(store)
visAssignChan <- ok
vis.SetLogstore(store)

if launchBrowser {
runBrowser(conf, log)
}

ctx, cancel := cmdutil.SignalContext(context.Background(), log)
setStopFunction(log, cancel, v.Close)

defer cancel()
setStopFunction(log, cancel, vis.Close)

// Wait.
<-ctx.Done()

if err = v.Close(); err != nil {
log.Error("Error closing visor: ", err)
}
stopVisorFn()
}

// Execute executes root CLI command.
Expand Down Expand Up @@ -238,11 +240,7 @@ func initConfig(mLog *logging.MasterLogger, args []string, confPath string) *vis
}

if confPath == "" {
if runtime.GOOS == "darwin" {
confPath = os.Getenv("HOME") + "/Skywire/" + defaultConfigName
} else {
confPath = "/opt/skywire/" + defaultConfigName
}
confPath = filepath.Join(skyenv.PackageSkywirePath(), defaultConfigName)
}

fallthrough
Expand Down
14 changes: 10 additions & 4 deletions cmd/skywire-visor/commands/systray.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,26 @@ func runApp(args ...string) {

conf := initConfig(l, args, confPath)

systray.Run(gui.GetOnGUIReady(sysTrayIcon, conf), gui.OnGUIQuit)
<-visAssignChan

systray.Run(gui.GetOnGUIReady(sysTrayIcon, conf, vis), gui.OnGUIQuit)

}

func setStopFunction(log *logging.MasterLogger, cancel context.CancelFunc, stopVisorFn func() error) {
func setStopFunction(log *logging.MasterLogger, cancel context.CancelFunc, fn func() error) {
stopVisorWg.Add(1)
defer stopVisorWg.Done()

gui.SetStopVisorFn(func() {
if err := stopVisorFn(); err != nil {
stopVisorFn = func() {
if err := fn(); err != nil {
log.WithError(err).Error("Visor closed with error.")
}
cancel()
stopVisorWg.Wait()
}

gui.SetStopVisorFn(func() {
stopVisorFn()
})
}

Expand Down
31 changes: 31 additions & 0 deletions docs/mac_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# MacOS

## Installation

### Developer

Prequisites:

- Xcode
- MacOS Host

Run `make mac-installer` on the root of the `skywire` directory

It should output two installer for `amd64 (Intel Mac)` and `arm64 (M1 Macs)` so install one that depends on your CPU
arch / ISA.

### End User

- Download the pkg / dmg for your machine, depends on your CPU arch / ISA.
- Install it.

## Running

### Directory Layout

- Skywire's config directory as well as other binaries is in `/Users/${USER}/Library/Application\ Support/Skywire`
- Runtime logs is in `/Users/${USER}/Library/Logs/Skywire/visor.log`

## Updating

Same as Installation, choose the `Update` option.
2 changes: 1 addition & 1 deletion docs/systray-builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $ gnome-extensions enable ubuntu-appindicators@ubuntu.com

#### Mac / Darwin

You need to have an icon defined in `/Applications/Skywire.app/Contents/Resources/tray_icon.png`
You need to have an icon defined in `/Applications/Skywire.app/Contents/Resources/icon.tiff`

#### Windows

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ require (
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 // indirect
go.etcd.io/bbolt v1.3.5
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/tools v0.1.2 // indirect
golang.zx2c4.com/wireguard v0.0.20200320
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d h1:RNPAfi2nHY7C2srAV8A49jpsYr0ADedCk1wq6fTMTvs=
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
Expand Down
Loading