Merge pull request #242 from Nadav-Ruskin/wsl_fix_missing_config

Fixed trying to read wsl.conf when it's missing
This commit is contained in:
Matt McCormick 2018-07-13 15:03:26 -04:00 committed by GitHub
commit 4689069099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,11 +185,13 @@ fi
if [ -n "$UBUNTU_ON_WINDOWS" ]; then if [ -n "$UBUNTU_ON_WINDOWS" ]; then
WSL_ROOT="/mnt/" WSL_ROOT="/mnt/"
CFG_FILE=/etc/wsl.conf CFG_FILE=/etc/wsl.conf
if [ -f "$CFG_FILE" ]; then
CFG_CONTENT=$(cat $CFG_FILE | sed -r '/[^=]+=[^=]+/!d' | sed -r 's/\s+=\s/=/g') CFG_CONTENT=$(cat $CFG_FILE | sed -r '/[^=]+=[^=]+/!d' | sed -r 's/\s+=\s/=/g')
eval "$CFG_CONTENT" eval "$CFG_CONTENT"
if [ -n "$root" ]; then if [ -n "$root" ]; then
WSL_ROOT=$root WSL_ROOT=$root
fi fi
fi
HOST_PWD=`pwd -P` HOST_PWD=`pwd -P`
HOST_PWD=${HOST_PWD/$WSL_ROOT//} HOST_PWD=${HOST_PWD/$WSL_ROOT//}
elif [ -n "$MSYS" ]; then elif [ -n "$MSYS" ]; then