Skip to content

Commit

Permalink
Create ~/.java/current/ symbolic links in /home/tooling/ instead of /…
Browse files Browse the repository at this point in the history
…home/user/

In order for stow in the UDI's entrypoint to complete successfully,
any files present in /home/user/ (that are not in the .stow-local-ignore)
must not also exist in /home/tooling/, otherwise a conflict would occur.

Since the symbolic link creation from JAVA_HOME_8/11/17 occurs before stow
is executed, the symbolic link must be created from JAVA_HOME_8/11/17 -> /home/tooling/
to prevent a stow conflict.

Stow will then create a symbolic link from
/home/tooling/.java/current/ -> /home/user/.java/current/ so that JAVA_HOME remains valid.

Signed-off-by: Andrew Obuchowicz <[email protected]>
  • Loading branch information
AObuchow committed Nov 21, 2023
1 parent 82cfdbf commit 49b87a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions devspaces-udi/etc/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ fi
# use java 17 if USE_JAVA17 is set to 'true',
# by default it is java 11
#############################################################################
rm -rf "${HOME}"/.java/current
mkdir -p "${HOME}"/.java/current
rm -rf /home/tooling/.java/current
mkdir -p /home/tooling/.java/current
if [ "${USE_JAVA8}" == "true" ] && [ ! -z "${JAVA_HOME_8}" ]; then
ln -s "${JAVA_HOME_8}"/* "${HOME}"/.java/current
ln -s "${JAVA_HOME_8}"/* /home/tooling/.java/current
echo "Java environment set to ${JAVA_HOME_8}"
elif [ "${USE_JAVA17}" == "true" ] && [ ! -z "${JAVA_HOME_17}" ]; then
ln -s "${JAVA_HOME_17}"/* "${HOME}"/.java/current
ln -s "${JAVA_HOME_17}"/* /home/tooling/.java/current
echo "Java environment set to ${JAVA_HOME_17}"
else
# End of Support for OpenJDK 11 in October 2024
# https://access.redhat.com/articles/1299013
echo "TODO: it needs to set JDK 17 as default before OpenJDK 11 hits EOL in October 2024"
ln -s "${JAVA_HOME_11}"/* "${HOME}"/.java/current
ln -s "${JAVA_HOME_11}"/* /home/tooling/.java/current
echo "Java environment set to ${JAVA_HOME_11}"
fi

Expand Down

0 comments on commit 49b87a9

Please sign in to comment.