Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved win short directory conversion into bash #347

Merged
merged 1 commit into from
Feb 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions assembly/assembly-main/src/assembly/bin/che.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ REM Check to ensure bash is installed
CALL bash --help > nul 2>&1
IF %ERRORLEVEL% NEQ 0 goto setup

REM IDEX-4232 change windows long directories to DOS 8.3 format to handle directories with spaces
FOR %%i in ("%~dp0..") do set "CHE_WINDOWS_SHORT_DIR=%%~Si"

REM Launch Che and any associated docker machines, if necessary
CALL bash --login -i "%~dp0\che.sh" %*

Expand Down
26 changes: 20 additions & 6 deletions assembly/assembly-main/src/assembly/bin/che.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ set_environment_variables () {
# The base directory of Che
if [ -z "${CHE_HOME}" ]; then
if [ "${WIN}" == "true" ]; then
export CHE_HOME="${CHE_WINDOWS_SHORT_DIR}"
# che-497: Determine windows short directory name in bash
export CHE_HOME=`(cmd //C 'FOR %i in (%~dp0\..\..) do @echo %~Si')`
else
export CHE_HOME="$(dirname "$(cd "$(dirname "${0}")" && pwd -P)")"
fi
Expand All @@ -250,14 +251,27 @@ set_environment_variables () {
export DOCKER_MACHINE_HOST="${CHE_IP}"
fi

# che-497: Convert JAVA_HOME to short directory name for Windows
if [ -z "${CHE_HOME}" ]; then
if [ "${WIN}" == "true" ]; then
# che-497: Determine windows short directory name in bash
export CHE_HOME=`(cmd //C 'FOR %i in (%~dp0\..\..) do @echo %~Si')`
else
export CHE_HOME="$(dirname "$(cd "$(dirname "${0}")" && pwd -P)")"
fi
fi

if [ "${WIN}" == "true" ] && [ ! -z "${JAVA_HOME}" ]; then
# che-497: Determine windows short directory name in bash
export JAVA_HOME=`(cygpath -u $(cygpath -w --short-name "${JAVA_HOME}"))`
fi

# Convert Tomcat environment variables to POSIX format.
if [[ "${JAVA_HOME}" == *":"* ]]
then
if [[ "${JAVA_HOME}" == *":"* ]]; then
JAVA_HOME=$(echo /"${JAVA_HOME}" | sed 's|\\|/|g' | sed 's|:||g')
fi

if [[ "${CHE_HOME}" == *":"* ]]
then
if [[ "${CHE_HOME}" == *":"* ]]; then
CHE_HOME=$(echo /"${CHE_HOME}" | sed 's|\\|/|g' | sed 's|:||g')
fi

Expand Down Expand Up @@ -477,7 +491,7 @@ call_catalina () {

if [[ "${SKIP_JAVA_VERSION}" == false ]]; then
# Che requires Java version 1.8 or higher.
JAVA_VERSION=$("${JAVA_HOME}"/bin/java -version 2>&1 | awk -F '"' '/version/ {print $2}')
JAVA_VERSION=$("${JAVA_HOME}/bin/java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [ -z "${JAVA_VERSION}" ]; then
error_exit "Failure running JAVA_HOME/bin/java -version. We received ${JAVA_VERSION}."
return
Expand Down