Skip to content

Commit

Permalink
Windows installer, fixes #786, fixes #780, fixes #798, fixes #701 (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed May 4, 2018
1 parent ba4cfde commit 80ec87b
Show file tree
Hide file tree
Showing 7 changed files with 441 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .circleci/circle_vm_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -x
# Basic tools

sudo apt-get update -qq
sudo apt-get install -qq mysql-client realpath zip
sudo apt-get install -qq mysql-client realpath zip nsis

# golang of the version we want
sudo apt-get remove -qq golang && sudo rm -rf /usr/local/go &&
Expand Down
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:

# Now build using the regular ddev-only technique - this results in a fully clean set of executables.
- run:
command: make -s clean linux darwin windows
command: |
make -s clean linux darwin windows_install
name: Build the ddev executables

# Run the built-in ddev tests with the executables just built.
Expand Down
1 change: 1 addition & 0 deletions .circleci/generate_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ zip $ARTIFACTS/ddev_linux.$VERSION.zip ddev ddev_bash_completion.sh
cd $BASE_DIR/bin/windows/windows_amd64
tar -czf $ARTIFACTS/ddev_windows.$VERSION.tar.gz ddev.exe ddev_bash_completion.sh
zip $ARTIFACTS/ddev_windows.$VERSION.zip ddev.exe ddev_bash_completion.sh
cp ddev_windows_installer*.exe $ARTIFACTS

# Create the sha256 files
cd $ARTIFACTS
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

GOMETALINTER_ARGS := --vendored-linters --disable-all --enable=gofmt --enable=vet --enable vetshadow --enable=golint --enable=errcheck --enable=staticcheck --enable=ineffassign --enable=varcheck --enable=deadcode --deadline=2m

WINDOWS_SUDO_VERSION=v0.0.1

##### These variables need to be adjusted in most repositories #####

# This repo's root import path (under GOPATH).
Expand Down Expand Up @@ -57,7 +59,7 @@ include build-tools/makefile_components/base_build_go.mak
#include build-tools/makefile_components/base_test_go.mak
#include build-tools/makefile_components/base_test_python.mak

.PHONY: test testcmd testpkg build setup staticrequired
.PHONY: test testcmd testpkg build setup staticrequired windows_install

TESTOS = $(shell uname -s | tr '[:upper:]' '[:lower:]')

Expand Down Expand Up @@ -91,3 +93,11 @@ setup:

# Required static analysis targets used in circleci - these cause fail if they don't work
staticrequired: gometalinter

windows_install: windows bin/windows/windows_amd64/sudo.exe bin/windows/windows_amd64/sudo_license.txt
makensis -DVERSION=$(VERSION) winpkg/ddev.nsi # brew install makensis, apt-get install nsis, or install on Windows

bin/windows/windows_amd64/sudo.exe bin/windows/windows_amd64/sudo_license.txt:
curl -sSL -o /tmp/sudo.zip -O https://github.com/mattn/sudo/releases/download/$(WINDOWS_SUDO_VERSION)/sudo-x86_64.zip
unzip -o -d $(PWD)/bin/windows/windows_amd64 /tmp/sudo.zip
curl -sSL -o $(PWD)/bin/windows/windows_amd64/sudo_license.txt https://raw.githubusercontent.com/mattn/sudo/master/LICENSE
6 changes: 2 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ You can also easily perform the installation or upgrade manually if preferred. d
- Move ddev to /usr/local/bin: `mv ddev /usr/local/bin/` (may require sudo), or another directory in your `$PATH` as preferred.
- Run `ddev` to test your installation. You should see ddev's command usage output.

### Manual Installation or Upgrade - Windows
### Installation or Upgrade - Windows

- Download and extract the latest [ddev release](https://github.com/drud/ddev/releases) for Windows.
- Copy `ddev.exe` into `%HOMEPATH%\AppData\Local\Microsoft\WindowsApps`, or otherwise add `ddev.exe` to a folder defined in your `PATH`
- Run `ddev` from a Command Prompt or PowerShell to test your installation. You should see ddev's command usage output.
- A windows installer is provided in the release (`ddev_windows_installer.<version>.exe`). Run that and it will do the full installation for you. If you get a Windows Defender Smartscreen warning "Windows protected your PC", click "More info" and then "Run anyway". Open a new terminal or cmd window and start using ddev.

### Versioning

Expand Down
6 changes: 4 additions & 2 deletions pkg/ddevapp/ddevapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ func (app *DdevApp) AddHostsEntries() error {
continue
}

_, err = osexec.Command("sudo", "-h").Output()
_, err = osexec.LookPath("sudo")
if (os.Getenv("DRUD_NONINTERACTIVE") != "") || err != nil {
util.Warning("You must manually add the following entry to your hosts file:\n%s %s\nOr with root/administrative privileges execute 'ddev hostname %s %s'", dockerIP, name, name, dockerIP)
return nil
Expand All @@ -981,7 +981,9 @@ func (app *DdevApp) AddHostsEntries() error {
util.Warning(fmt.Sprintf(" sudo %s", command))
output.UserOut.Println("Please enter your password if prompted.")
_, err = exec.RunCommandPipe("sudo", hostnameArgs)
util.CheckErr(err)
if err != nil {
util.Warning("Failed to execute sudo command, you will need to manually execute '%s' with administrative privileges", command)
}
}
return nil
}
Expand Down

0 comments on commit 80ec87b

Please sign in to comment.