Solved how to pass env to sh through sudo

I am installing idempiere and I am at the last script. Which is:
Code:
#!/bin/sh
#
if [ $JAVA_HOME ]; then
  JAVA=$JAVA_HOME/bin/java
else
  JAVA=java
  echo JAVA_HOME is not set.
  echo You may not be able to start the Setup
  echo Set JAVA_HOME to the directory of your local JDK.
fi

# sign database build
$JAVA -jar plugins/org.eclipse.equinox.launcher_1.*.jar -install setup -configuration setup/configuration -application org.adempiere.base.SignDatabaseBuildApplicatio

Due to the nature of the install I must use a user id that has no login so I am employing sudo.
The command used is: sudo -u idempiere sh sign-database-build-alt.sh. However this does not have JAVA_HOME defined. How do I pass JAVA_HOME="/usr/local/openjdk12" to the sudo call to sh?

A.
Code:
export JAVA_HOME="/usr/local/openjdk12" ; sudo -E -u idempiere sh sign-database-build-alt.sh
 
Back
Top