Skip to content

Commit

Permalink
Fix IP check on Windows #102
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Jan 20, 2019
1 parent 654b4b9 commit 67b8890
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Project website: https://github.com/mviereck/x11docker
- Add `-nolisten local` to X commands to forbid abstract socket connections.
### Fixed
- `-t, --tty`: Long option was not parsed.
- Fixed IP check on MS Windows
[(#102)](https://github.com/mviereck/x11docker/issues/102)


## [5.3.3](https://github.com/mviereck/x11docker/releases/tag/v5.3.3) - 2018-11-17
### Added
Expand Down
18 changes: 9 additions & 9 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -5094,15 +5094,6 @@ check_host() { # check host environment
} || {
Hostutctime="UTC+$(cut -c2- <<< "$Hostutctime")"
}

# Check host IP. Needed for --pulseaudio=tcp, --vcxsrv and --xwin
case $Winsubsystem in
"") Hostip="$(ip -4 -o a | grep 'docker0' | awk '{print $4}' | cut -d/ -f1)"
[ "$Hostip" ] || Hostip="$(ip -4 -o a | awk '{print $4}' | cut -d/ -f1 | grep -v 127.0.0.1 | head -n1)" ;;
*) Hostip="$(ipconfig.exe | grep -A6 'DockerNAT' | grep 'IPv4' | rev | cut -d' ' -f1 | rev)"
[ "$Hostip" ] || Hostip="$(ipconfig.exe | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep "^10\.0\.*" )"
[ "$Hostip" ] || Hostip="$(ipconfig.exe | grep 'IPv4' | head -n1 | | rev | cut -d' ' -f1 | rev)" ;;
esac

# Check for MS Windows subsystem
uname -r | grep -q Microsoft && Winsubsystem="WSL"
Expand All @@ -5125,6 +5116,15 @@ check_host() { # check host environment
Hostsystem="Windows-$Winsubsystem"
}

# Check host IP. Needed for --pulseaudio=tcp, --vcxsrv and --xwin
case $Winsubsystem in
"") Hostip="$(ip -4 -o a | grep 'docker0' | awk '{print $4}' | cut -d/ -f1)"
[ "$Hostip" ] || Hostip="$(ip -4 -o a | awk '{print $4}' | cut -d/ -f1 | grep -v 127.0.0.1 | head -n1)" ;;
*) Hostip="$(ipconfig.exe | grep -A6 'DockerNAT' | grep 'IPv4' | rev | cut -d' ' -f1 | rev)"
[ "$Hostip" ] || Hostip="$(ipconfig.exe | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep "^10\.0\.*" )"
[ "$Hostip" ] || Hostip="$(ipconfig.exe | grep 'IPv4' | head -n1 | | rev | cut -d' ' -f1 | rev)" ;;
esac

# Provide dos->unix newline converter to $Mksu commands
export -f rmcr

Expand Down

0 comments on commit 67b8890

Please sign in to comment.