This repository has been archived by the owner on Jun 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 152
[TRAFODION-2802 ] source the .bashrc before access JAVA_HOME #1413
Open
xiaozhongwang
wants to merge
1
commit into
apache:master
Choose a base branch
from
xiaozhongwang:TRAFODION-2802
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,11 +244,14 @@ if [ ! -d ${javapath} ]; then | |
exit 1 | ||
fi | ||
|
||
source $HOME/.bashrc | ||
javahome=`grep JAVA_HOME ~/.bashrc | wc -l` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment above |
||
if [ "x${javahome}" = "x0" ]; then | ||
echo -en "\n# Added by traf_checkset_env.sh of trafodion\n" >> $HOME/.bashrc | ||
echo -en "export JAVA_HOME=${javapath}\n" >> $HOME/.bashrc | ||
echo -en "export PATH=\$PATH:\$JAVA_HOME/bin\n" >> $HOME/.bashrc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment above. Writing into the user's .bashrc is probably not a very good idea. You can create a file ~/.trafodion instead. |
||
export JAVA_HOME=${javapath} | ||
export PATH=$PATH:$JAVA_HOME/bin | ||
else | ||
java_version=`${JAVA_HOME}/bin/java -version 2>&1 | awk 'NR==1{ gsub(/"/,""); print $3}'` | ||
case ${java_version} in | ||
|
@@ -268,11 +271,13 @@ if [ "x${local_locale}" != "x" ]; then | |
if [ "x${lang_set}" != "xen_US.UTF-8" ]; then | ||
echo -en "\n# Added by traf_checkset_env.sh of trafodion\n" >> $HOME/.bashrc | ||
echo -en "export LANG=\"en_US.UTF-8\"\n" >> $HOME/.bashrc | ||
export LANG="en_US.UTF-8" | ||
fi | ||
lc_all_set=`grep LC_TIME ~/.bashrc | awk -F= '{ print $2 }'` | ||
if [ "x${lc_all_set}" != "xen_US.UTF-8" ]; then | ||
echo -en "\n# Added by traf_checkset_env.sh of trafodion\n" >> $HOME/.bashrc | ||
echo -en "export LC_ALL=\"en_US.UTF-8\"\n" >> $HOME/.bashrc | ||
export LC_ALL="en_US.UTF-8" | ||
fi | ||
fi | ||
|
||
|
@@ -282,7 +287,6 @@ if (("${#faillibs[@]}" > "0")); then | |
exit 1; | ||
fi | ||
|
||
source $HOME/.bashrc | ||
echo $'\n'"Build environment is created SUCCESS!" | ||
|
||
echo $'\n'"Install the required Build tools start!" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sourcing ~/.bashrc and looking into this file is not a very good solution, IMHO. There are so many other ways we can set JAVA_HOME. For example: /etc/bashrc, ~/.trafodion, $TRAF_HOME/.sqenvcom.sh.
I would suggest to just check whether JAVA_HOME is set, otherwise duplicate the code in $TRAF_HOME/.sqenvcom.sh that sets JAVA_HOME. If JAVA_HOME is not already set, then you can then add a line
export JAVA_HOME=...
To the file ~/.trafodion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before, we must prepare environment step by step as following document: [https://cwiki.apache.org/confluence/display/TRAFODION/Create+Build+Environment]
I only write them in one command.
Yes. I think this is not a good way too.