44 lines
1.6 KiB
Diff
44 lines
1.6 KiB
Diff
commit 4e5fe2a6ec5690b51a369d2134a1119962438fd1
|
|
Author: Werner Fink <werner@suse.de>
|
|
Date: Tue Sep 4 12:22:09 2018 +0200
|
|
|
|
Avoid `ls' command in alljava shell scriptlets
|
|
|
|
with this the error messageses for not existing directories
|
|
are gone even for (t)csh. Also the `-I' option had never
|
|
worked as expected due missed shell patterns.
|
|
|
|
Signed-off-by: Werner Fink <werner@suse.de>
|
|
|
|
diff --git a/files/etc/profile.d/alljava.csh b/files/etc/profile.d/alljava.csh
|
|
index d2d2378..602ee72 100644
|
|
--- a/files/etc/profile.d/alljava.csh
|
|
+++ b/files/etc/profile.d/alljava.csh
|
|
@@ -13,7 +13,9 @@ foreach JDIR ( "/usr/lib64/jvm" "/usr/lib/jvm" "/usr/java/latest" "/usr/java" )
|
|
|
|
if ( ! -d $JDIR ) continue
|
|
|
|
- foreach JPATH ( $JDIR $JDIR/java `ls -I 'java' -I 'jre' -d $JDIR/*` $JDIR/jre )
|
|
+ foreach JPATH ( $JDIR $JDIR/java $JDIR/java-[a-z]* $JDIR/java-[0-9]* $JDIR/jre $JDIR/jre-[a-z]* $JDIR/jre-[0-9]* )
|
|
+
|
|
+ if ( ! -d $JPATH ) continue
|
|
|
|
if ( ! -x $JPATH/bin/java ) continue
|
|
|
|
diff --git a/files/etc/profile.d/alljava.sh b/files/etc/profile.d/alljava.sh
|
|
index 8c92a3f..8a2062a 100644
|
|
--- a/files/etc/profile.d/alljava.sh
|
|
+++ b/files/etc/profile.d/alljava.sh
|
|
@@ -15,7 +15,11 @@ for JDIR in /usr/lib64/jvm /usr/lib/jvm /usr/java/latest /usr/java; do
|
|
continue
|
|
fi
|
|
|
|
- for JPATH in $JDIR $JDIR/java `ls -I 'java' -I 'jre' -d $JDIR/* 2>/dev/null` $JDIR/jre; do
|
|
+ for JPATH in $JDIR $JDIR/java $JDIR/java-[a-z]* $JDIR/java-[0-9]* $JDIR/jre $JDIR/jre-[a-z]* $JDIR/jre-[0-9]*; do
|
|
+
|
|
+ if ! test -d $JPATH; then
|
|
+ continue
|
|
+ fi
|
|
|
|
if ! test -x $JPATH/bin/java; then
|
|
continue
|