diff options
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | branding/qtinstaller/config/config.xml | 9 | ||||
-rw-r--r-- | branding/qtinstaller/packages/root.win_x86_64/meta/installscript.js | 6 | ||||
-rw-r--r-- | docs/build.windows.rst | 9 | ||||
-rw-r--r--[-rwxr-xr-x] | gui/build.sh (renamed from build.sh) | 0 | ||||
-rw-r--r-- | pkg/helper/helper.go | 4 | ||||
-rw-r--r-- | pkg/helper/windows.go | 18 |
7 files changed, 42 insertions, 15 deletions
@@ -8,6 +8,7 @@ XBUILD ?= no SKIP_CACHECK ?= no PROVIDER ?= $(shell grep ^'provider =' branding/config/vendor.conf | cut -d '=' -f 2 | tr -d "[:space:]") +TARGET ?= bitmask PROVIDER_CONFIG ?= branding/config/vendor.conf DEFAULT_PROVIDER = branding/assets/default/ VERSION ?= $(shell git describe) @@ -20,11 +21,12 @@ SOURCE_GOLIB=gui/backend.go # detect OS, we use it for dependencies UNAME = $(shell uname -s) PLATFORM ?= $(shell echo ${UNAME} | awk "{print tolower(\$$0)}") +WININST_DATA = branding/qtinstaller/packages/root.win_x86_64/data/ TEMPLATES = branding/templates SCRIPTS = branding/scripts -all: icon locales build +all: icon locales helper build ######################################################################### @@ -66,7 +68,7 @@ else ifeq (${XBUILD}, osx) $(MAKE) build_cross_osx $(MAKE) _build_done else - $(MAKE) _buildparts + @gui/build.sh endif @@ -224,8 +226,9 @@ package_deb: @make -C build/${PROVIDER} pkg_deb installer_win: - cp qtbuild/release/bitmask.exe branding/qtinstaller/packages/root.win_x86_64/data/${PROVIDER}-vpn.exe - windeployqt --qmldir gui/qml branding/qtinstaller/packages/root.win_x86_64/data/${PROVIDER}-vpn.exe + cp helper.exe ${WININST_DATA} + cp qtbuild/release/${TARGET}.exe ${WININST_DATA}${PROVIDER}-vpn.exe + windeployqt --qmldir gui/qml ${WININST_DATA}${PROVIDER}-vpn.exe "/c/Qt/QtIFW-3.2.2/bin/binarycreator.exe" -c ./branding/qtinstaller/config/config.xml -p ./branding/qtinstaller/packages build/${PROVIDER}-vpn-${VERSION}-installer.exe # FIXME --- old nsis installer. deprecate, but probably we need something similar to sign all the binaries (helper, main app, installer...) diff --git a/branding/qtinstaller/config/config.xml b/branding/qtinstaller/config/config.xml index 4469d65..8ce9b2e 100644 --- a/branding/qtinstaller/config/config.xml +++ b/branding/qtinstaller/config/config.xml @@ -1,9 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <Installer> - <Name>DemoLibVPN</Name> + <Name>DemoLibVPN-0.0.1</Name> <Version>0.0.1</Version> <Title>DemoLibVPN Installer</Title> <Publisher>LEAP Encryption Access Project</Publisher> - <StartMenuDir>DemoLibVPN</StartMenuDir> <TargetDir>@ApplicationsDir@/DemoLibVPN</TargetDir> + <RunProgram>@TargetDir@/demolib-vpn.exe</RunProgram> + <RunProgramArguments> + </RunProgramArguments> + <StartMenuDir>DemoLibVPN</StartMenuDir> + <MaintenanceToolName>Uninstall-DemoLibVPN</MaintenanceToolName> + <AllowNonAsciiCharacters>false</AllowNonAsciiCharacters> </Installer> diff --git a/branding/qtinstaller/packages/root.win_x86_64/meta/installscript.js b/branding/qtinstaller/packages/root.win_x86_64/meta/installscript.js index 691d1a4..1598458 100644 --- a/branding/qtinstaller/packages/root.win_x86_64/meta/installscript.js +++ b/branding/qtinstaller/packages/root.win_x86_64/meta/installscript.js @@ -69,7 +69,9 @@ Component.prototype.createOperations = function() if (systemInfo.productType === "windows") { console.log("Adding shortcut entries"); component.addElevatedOperation("Mkdir", "@StartMenuDir@"); - component.addElevatedOperation("CreateShortcut", "@TargetDir@/demolib-vpn.exe", "@StartMenuDir@/DemoLibVPN.lnk", "workingDirectory=@TargetDir@", "iconPath=%SystemRoot%/system32/SHELL32.dll", "iconId=2", "description=Start DemoLibVPN"); - component.addElevatedOperation("CreateShortcut", "@TargetDir@/maintenancetool.exe", "@StartMenuDir@/uninstall.lnk", "workingDirectory=@TargetDir@", "iconPath=%SystemRoot%/system32/SHELL32.dll", "iconId=2", "description=Uninstall application"); + component.addElevatedOperation("CreateShortcut", "@TargetDir@/demolib-vpn.exe", "@StartMenuDir@/DemoLibVPN.lnk", "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/icon.ico", "description=Start DemoLibVPN"); + + // TODO I think this one is not being created because the path doesn't exist yet. We might want to do this by hooking on the installation finished signal instead. + component.addElevatedOperation("CreateShortcut", "@TargetDir@/Uninstall-DemoLibVPN.exe", "@StartMenuDir@/Uninstall.lnk"); } } diff --git a/docs/build.windows.rst b/docs/build.windows.rst new file mode 100644 index 0000000..a0c7a56 --- /dev/null +++ b/docs/build.windows.rst @@ -0,0 +1,9 @@ +windows build notes (still some manual steps needed, this should be further automated). +======================================================================================= + +PROVIDER=DemoLib make helper +INSTALLER_DATA=branding/qtinstaller/packages/root.win_x86_64/data/ +mkdir -p INSTALLER_DATA +mv main.exe ${INSTALLER_DATA}/helper.exe +TARGET=demolib-vpn make build +TARGET=demolib-vpn make installer_win diff --git a/build.sh b/gui/build.sh index 1ded17e..1ded17e 100755..100644 --- a/build.sh +++ b/gui/build.sh diff --git a/pkg/helper/helper.go b/pkg/helper/helper.go index 9d0b330..691fc6e 100644 --- a/pkg/helper/helper.go +++ b/pkg/helper/helper.go @@ -29,9 +29,9 @@ import ( ) var ( - AppName = "DemoLibVPN" + AppName = "DemoLibVPN" BinaryName = "bitmask" - Version = "git" + Version = "git" ) type openvpnT struct { diff --git a/pkg/helper/windows.go b/pkg/helper/windows.go index ef4f271..44ac6f5 100644 --- a/pkg/helper/windows.go +++ b/pkg/helper/windows.go @@ -33,8 +33,10 @@ import ( var ( svcName = BinaryName + `-helper-v2` + + // XXX this is set to c:\WINDOWS\system32 on initialization. Do not use it, use a function call instead. appPath = getExecDir() - LogFolder = appPath + LogFolder = getExecDir() openvpnPath = path.Join(appPath, "openvpn.exe") chocoOpenvpnPath = `C:\Program Files\OpenVPN\bin\openvpn.exe` platformOpenvpnFlags = []string{ @@ -47,9 +49,11 @@ var ( func getExecDir() string { ex, err := os.Executable() if err != nil { - log.Fatal("Cannot find executable path") + log.Println("Cannot find executable path") + return "" } - return path.Dir(ex) + /* XXX filepath.Abs is buggy, maybe because of spaces in the path. fuck it, this is good enough for now */ + return strings.Replace(ex, "\\helper.exe", "", 1) } type httpConf struct { @@ -131,11 +135,15 @@ func daemonize() {} func runServer(port int) {} func getOpenvpnPath() string { - if _, err := os.Stat(openvpnPath); !os.IsNotExist(err) { - return openvpnPath + openvpn := path.Join(getExecDir(), "openvpn.exe") + if _, err := os.Stat(openvpn); !os.IsNotExist(err) { + log.Println("DEBUG: openvpnpath found,", openvpnPath) + return openvpn } else if _, err := os.Stat(chocoOpenvpnPath); !os.IsNotExist(err) { + log.Println("DEBUG: choco openvpn found,", chocoOpenvpnPath) return chocoOpenvpnPath } + log.Println("DEBUG: did not find system-wide openvpn...") return "openvpn.exe" } |