mirror of
https://github.com/netbirdio/netbird.git
synced 2025-02-18 03:01:31 +01:00
Add UI binary to windows installer (#285)
This PR adds Desktop UI to Windows installer
This commit is contained in:
parent
97ab8f4c34
commit
a15d52b263
@ -15,6 +15,13 @@
|
|||||||
!define REG_ROOT "HKLM"
|
!define REG_ROOT "HKLM"
|
||||||
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}"
|
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}"
|
||||||
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
||||||
|
|
||||||
|
!define UI_APP_NAME "Wiretrustee UI"
|
||||||
|
!define UI_APP_EXE "Wiretrustee-ui"
|
||||||
|
|
||||||
|
!define UI_REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${UI_APP_EXE}"
|
||||||
|
!define UI_UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UI_APP_NAME}"
|
||||||
|
|
||||||
Unicode True
|
Unicode True
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
@ -77,6 +84,7 @@ Section -MainProgram
|
|||||||
SetOverwrite ifnewer
|
SetOverwrite ifnewer
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
File /r "..\\dist\\wiretrustee_windows_amd64\\"
|
File /r "..\\dist\\wiretrustee_windows_amd64\\"
|
||||||
|
File /r "..\\dist\\wiretrustee-ui_windows_amd64\\"
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
@ -93,6 +101,13 @@ WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_
|
|||||||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
|
||||||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
|
||||||
|
|
||||||
|
WriteRegStr ${REG_ROOT} "${UI_REG_APP_PATH}" "" "$INSTDIR\${UI_APP_EXE}"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UI_UNINSTALL_PATH}" "DisplayName" "${UI_APP_NAME}"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UI_UNINSTALL_PATH}" "UninstallString" "$INSTDIR\wiretrustee_uninstall.exe"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UI_UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${UI_APP_EXE}"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UI_UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UI_UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
|
||||||
|
|
||||||
EnVar::SetHKLM
|
EnVar::SetHKLM
|
||||||
EnVar::AddValueEx "path" "$INSTDIR"
|
EnVar::AddValueEx "path" "$INSTDIR"
|
||||||
|
|
||||||
|
@ -4,8 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "embed"
|
_ "embed"
|
||||||
@ -22,6 +27,11 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
var daemonAddr string
|
var daemonAddr string
|
||||||
|
|
||||||
|
if err := checkPIDFile(); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
defaultDaemonAddr := "unix:///var/run/wiretrustee.sock"
|
defaultDaemonAddr := "unix:///var/run/wiretrustee.sock"
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
defaultDaemonAddr = "tcp://127.0.0.1:41731"
|
defaultDaemonAddr = "tcp://127.0.0.1:41731"
|
||||||
@ -214,3 +224,19 @@ func (s *serviceClient) client() (proto.DaemonServiceClient, error) {
|
|||||||
s.conn = proto.NewDaemonServiceClient(conn)
|
s.conn = proto.NewDaemonServiceClient(conn)
|
||||||
return s.conn, nil
|
return s.conn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// checkPIDFile exists and return error, or write new.
|
||||||
|
func checkPIDFile() error {
|
||||||
|
pidFile := path.Join(os.TempDir(), "wiretrustee-ui.pid")
|
||||||
|
if piddata, err := ioutil.ReadFile(pidFile); err == nil {
|
||||||
|
if pid, err := strconv.Atoi(string(piddata)); err == nil {
|
||||||
|
if process, err := os.FindProcess(pid); err == nil {
|
||||||
|
if err := process.Signal(syscall.Signal(0)); err == nil {
|
||||||
|
return fmt.Errorf("process already exists: %d", pid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ioutil.WriteFile(pidFile, []byte(fmt.Sprintf("%d", os.Getpid())), 0o664)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user