Skip to content

Instantly share code, notes, and snippets.

@kjvalencik
Created March 27, 2014 13:15
Show Gist options
  • Save kjvalencik/9807325 to your computer and use it in GitHub Desktop.
Save kjvalencik/9807325 to your computer and use it in GitHub Desktop.
Replace the 64-bit java binary with a shell script that will use the 32-bit binary iif Juniper Network Connect is being loaded.
#!/bin/bash
JAVA=$(readlink -f `which java`)
JAVA32=$(echo $JAVA | sed 's/\/jvm\//\/jvm\/ia32-/ig')
if [ -a $JAVA.orig ]
then
echo "Binary already patched"
else
echo "Patching binary..."
mv $JAVA $JAVA.orig
#if [ $3x = "NCx" ]
#then
# /usr/lib/jvm/ia32-java-7-oracle/jre/bin/java "$@"
#else
# /usr/lib/jvm/java-7-oracle/jre/bin/java.orig "$@"
#fi
printf "#!/bin/bash\nif [ \$3x = \"NCx\" ]\nthen\n\t$JAVA32 \"\$@\"\nelse\n\t$JAVA.orig \"\$@\"\nfi\n" > $JAVA
chmod +x $JAVA
echo "Done!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment