File git-03-00d332a443062395957f422c89eaed9d0979ec00.patch of Package aaa_base.12878

commit 00d332a443062395957f422c89eaed9d0979ec00
Author: Ruediger Oertel <ro@suse.de>
Date:   Thu Mar 7 11:57:12 2019 +0100

    update logic for JRE_HOME env variable (bsc#1128246)

diff --git a/files/etc/profile.d/alljava.csh b/files/etc/profile.d/alljava.csh
index 602ee72..53f1c4f 100644
--- a/files/etc/profile.d/alljava.csh
+++ b/files/etc/profile.d/alljava.csh
@@ -30,7 +30,11 @@ foreach JDIR ( "/usr/lib64/jvm" "/usr/lib/jvm" "/usr/java/latest" "/usr/java" )
             setenv JRE_HOME $JPATH
             breaksw
         default:
-            setenv JRE_HOME $JPATH/jre
+            if ( -x $JPATH/jre/bin/java ) then
+                setenv JRE_HOME $JPATH/jre
+            else
+                setenv JRE_HOME $JPATH
+            endif
             # it is development kit=20
             if ( -x $JPATH/bin/javac ) then
                 setenv JDK_HOME $JPATH
diff --git a/files/etc/profile.d/alljava.sh b/files/etc/profile.d/alljava.sh
index 8a2062a..6caf082 100644
--- a/files/etc/profile.d/alljava.sh
+++ b/files/etc/profile.d/alljava.sh
@@ -37,7 +37,11 @@ for JDIR in /usr/lib64/jvm /usr/lib/jvm /usr/java/latest /usr/java; do
                 ;;
 
             *)
-                [ -z "$JRE_HOME" ] && export JRE_HOME=$JPATH/jre
+		if [ -x $JPATH/jre/bin/java ] ; then
+                    [ -z "$JRE_HOME" ] && export JRE_HOME=$JPATH/jre
+		else
+		    [ -z "$JRE_HOME" ] && export JRE_HOME=$JPATH
+		fi
                 # it is development kit
                 if [ -x $JPATH/bin/javac ] ; then
                     export JDK_HOME=$JPATH