Skip to content

Commit

Permalink
Zanderz/windows cleanup2 (keybase#16805)
Browse files Browse the repository at this point in the history
* more cleanup and docs

more cleanup

wip

* fix
  • Loading branch information
Steve Sanders authored and maxtaco committed Apr 2, 2019
1 parent 7cc33bd commit d5c0f8e
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 62 deletions.
6 changes: 6 additions & 0 deletions packaging/windows/build_prerelease.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ IF %ERRORLEVEL% NEQ 0 (
EXIT /B 1
)
popd

:: keybaserq
pushd %GOPATH%\src\github.com\keybase\client\go\tools\runquiet
del keybaserq.exe
..\..\keybase\winresource.exe -d "Keybase quiet start utility" -n "keybaserq.exe" -i ../../../media/icons/Keybase.ico
go build -ldflags "-H windowsgui" -o keybaserq.exe
25 changes: 0 additions & 25 deletions packaging/windows/buildrq.cmd

This file was deleted.

10 changes: 8 additions & 2 deletions packaging/windows/doinstaller_wix.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ call:dosignexe %GOPATH%\src\github.com\keybase\client\shared\desktop\release\win
call:dosignexe %GOPATH%\src\github.com\keybase\client\go\kbnm\kbnm.exe
:: prompter
call:dosignexe %GOPATH%\src\github.com\keybase\go-updater\windows\WpfPrompter\WpfApplication1\bin\Release\prompter.exe

if not EXIST %GOPATH%\src\github.com\keybase\client\go\tools\runquiet\keybaserq.exe call %GOPATH%\src\github.com\keybase\packaging\windows\buildrq.cmd
:: runquiet utility
call:dosignexe %GOPATH%\src\github.com\keybase\client\go\tools\runquiet\keybaserq.exe

:: Double check that keybase is codesigned
signtool verify /pa %PathName%
Expand Down Expand Up @@ -94,6 +94,12 @@ IF %ERRORLEVEL% NEQ 0 (
EXIT /B 1
)

:: Double check that the keybaserq exe is codesigned
signtool verify /pa %GOPATH%\src\github.com\keybase\client\go\tools\runquiet\keybaserq.exe
IF %ERRORLEVEL% NEQ 0 (
EXIT /B 1
)

set BUILD_TAG=%SEMVER%

pushd %GOPATH%\src\github.com\keybase\client\packaging\windows\WIXInstallers
Expand Down
20 changes: 0 additions & 20 deletions packaging/windows/dorelease.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,6 @@ if defined badbuildnumber (

call %GOPATH%\src\github.com\keybase\client\packaging\windows\build_prerelease.cmd || goto:build_error || EXIT /B 1


::RunQuiet Utility
pushd %GOPATH%\src\github.com\keybase\client\go\tools\runquiet
del rq.hash
del old.hash
powershell -command "wget https://s3.amazonaws.com/prerelease.keybase.io/windows-support/runquiet/runquiet.hash -OutFile old.hash"
git log -1 -- runquiet.go > rq.hash
fc rq.hash old.hash
if %ERRORLEVEL% EQU 0 (
echo "downloading keybaserq"
powershell -command "wget https://s3.amazonaws.com/prerelease.keybase.io/windows-support/runquiet/keybaserq.exe -OutFile keybaserq.exe"
) else (
echo "--- runquiet hashes differ, building keybaserq. Server hash: ---"
type old.hash
echo "--- Current hash: ---"
type rq.hash
call ..\..\..\packaging\windows\buildrq.cmd || goto:build_error || EXIT /B 1
)
popd

call %GOPATH%\src\github.com\keybase\client\packaging\windows\buildui.cmd || goto:build_error || EXIT /B 1

::Build Installer
Expand Down
71 changes: 56 additions & 15 deletions packaging/windows/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ git clone https://github.com/keybase/go-updater.git c:\work\src\github.com\keyba
- Try `C:\mingw-w64\.... instead`

## Building
[GCC via Mingw-64](https://sourceforge.net/projects/mingw-w64/) (for building kbfsdokan)
- Be sure and choose architecture x86-64, NOT i686
- Also recommend not installing in `program files`, e.g. `C:\mingw-w64\...` instead of `C:\Program Files (x86)\mingw-w64\...`

Environment:
```
Expand All @@ -64,27 +67,40 @@ set CPATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\include

## Building Installers

[Visual Studio 2015 Professional](https://visualstudio.microsoft.com/vs/older-downloads/)
- [Visual Studio 2015 Professional](https://visualstudio.microsoft.com/vs/older-downloads/)
(may require live.com account)

- Environment:
- `call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat"`
- [.net 3.5.1](https://www.microsoft.com/en-us/download/details.aspx?id=22)
- [WIX tools 3.11.1](http://wixtoolset.org/releases/)
- Codesigning: see /keybase/team/keybase.builds.windows/readme.html

## Building a debug installer without codesigning

Environment:
`call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat"`
`set KEYBASE_WINBUILD=0`

[.net 3.5.1](https://www.microsoft.com/en-us/download/details.aspx?id=22)
Invoke the scripts to build the executables: `build_prerelease.cmd`, and `buildui.cmd`

Update prompter executable:
```
cd %GOPATH%\src\github.com\keybase\go-updater\windows\WpfPrompter
msbuild WpfPrompter.sln /p:Configuration=Debug /t:Build
```

[WIX tools 3.11.1](http://wixtoolset.org/releases/)
Installer:
```
cd %GOPATH%\src\github.com\keybase\client\packaging\windows\WIXInstallers
msbuild WIX_Installers.sln /p:Configuration=Debug /p:Platform=x64 /t:Build
```

Codesigning: see /keybase/team/keybase.builds.windows/readme.html
## Production CMD Scripts

## CMD Scripts
`build_prerelease.cmd` builds most of the client executables
`buildui.bat` builds the ui
`buildrq.cmd` builds runquiet utility
- if you want this without code signing, try:
- from `go\tools\runquiet`:
`go build -ldflags "-H windowsgui" -o keybaserq.exe`
`doinstaller_wix.cmd` does codesigning on all the executabls and builds the installer
`dorelease.cmd` calls the above scripts and copies to s3. Invoked by the build bot.
- `build_prerelease.cmd` builds most of the client executables
- `buildui.bat` builds the ui
- `doinstaller_wix.cmd` does codesigning on all the executabls and builds the installer (requires signing certificate)
- `dorelease.cmd` calls the above scripts and copies to s3. Invoked by the build bot.

# Upgrading Dokan
Download `DokanSetup_redist.exe` from https://github.com/dokan-dev/dokany/releases
Expand All @@ -101,4 +117,29 @@ Optional: change the minimum version KBFS will work with: https://github.com/key

# Might be Useful...
- [Chocolatey](https://chocolatey.org/install) (helpful for yarn)
- then: `choco install yarn`
- then: `choco install yarn`

# Installed Product Layout and Functionality
The installer places/updates all the files and adds:
- startup shortcut for
- start menu shortcut
- background tile color

The service is invoked by the GUI with this command:
`[INSTALLFOLDER]\keybaserq.exe keybase.exe --log-format=file --log-prefix="[INSTALLFOLDER]watchdog." ctl watchdog2`
This starts a copy of keybase.exe in watchdog mode, which in turn runs the service and kbfs processes, restarting them if they die or are killed.
If the service is closed with `keybase ctl stop`, which the GUI does when the widtget menu is used, the watchdog will see a different exit code and not restart the processes.

`keybaserq.exe` has 2 main jobs: de-elevating permissions to run as current user, and running Keybase invisibly, without the CMD window appearing, since it is a console program.

Notable executables
`DokanSetup_redist.exe` - Dokan driver package, invoked from files tab in GUI
`git-remote-keybase.exe` - GIT helper
`kbfsdokan.exe` - kbfs
`kbnm.exe` - browser extension
`keybase.exe` - service
`keybase.rq.exe` - quiet launcher and de-elevator
`prompter.exe` - updater GUI
`upd.exe` - updater
`Gui\Keybase.exe` - GUI

0 comments on commit d5c0f8e

Please sign in to comment.