Blame SOURCES/symlink_libs.sh

9b2f7e
#!/bin/bash
9b2f7e
9b2f7e
# This script replaces plugins with symlinks
9b2f7e
# $1 : folder to replace with symlinks
9b2f7e
9b2f7e
set -e
9b2f7e
9b2f7e
SCL_JAVA_DIRS=${@:2}
9b2f7e
9b2f7e
pushd () {
9b2f7e
	command pushd "$@" > /dev/null
9b2f7e
}
9b2f7e
9b2f7e
popd () {
9b2f7e
	command popd "$@" > /dev/null
9b2f7e
}
9b2f7e
9b2f7e
function _sym {
9b2f7e
	if [ -f $1 ]; then
9b2f7e
		echo "linking $1 to $2"
9b2f7e
		rm -rf $1
9b2f7e
		ln -s $2 $1
9b2f7e
	else	
9b2f7e
		echo "Failed to find $1"
9b2f7e
		ls -l
9b2f7e
		exit 1
9b2f7e
	fi
9b2f7e
}
9b2f7e
9b2f7e
pushd $1
9b2f7e
	# owasp-java-encoder
9b2f7e
	_sym org.owasp.encoder_1.2.2.jar /usr/share/java/owasp-java-encoder/encoder.jar
9b2f7e
	# jaf
9b2f7e
	_sym com.sun.activation.jakarta.activation_1.2.1.jar /usr/share/java/jaf/jakarta.activation.jar
9b2f7e
	_sym jakarta.activation-api_1.2.1.jar /usr/share/java/jaf/jakarta.activation-api.jar
9b2f7e
	# jmc-core
9b2f7e
	_sym org.openjdk.jmc.common_7.0.0.jar /usr/share/java/jmc-core/common.jar
9b2f7e
	_sym org.openjdk.jmc.flightrecorder_7.0.0.jar /usr/share/java/jmc-core/flightrecorder.jar
9b2f7e
	_sym org.openjdk.jmc.flightrecorder.rules_7.0.0.jar /usr/share/java/jmc-core/flightrecorder.rules.jar
9b2f7e
	_sym org.openjdk.jmc.flightrecorder.rules.jdk_7.0.0.jar /usr/share/java/jmc-core/flightrecorder.rules.jdk.jar
9b2f7e
popd
9b2f7e
9b2f7e
function _symlink {
9b2f7e
	_f=$(ls | grep -e "^$1" || :)
9b2f7e
	if [ -n "$_f" ] ; then
9b2f7e
		rm -rf $_f
9b2f7e
		for SCL_JAVA_DIR in ${SCL_JAVA_DIRS}; do
9b2f7e
			if [ -f ${SCL_JAVA_DIR}/$2  ]; then
9b2f7e
				echo "found ${SCL_JAVA_DIR}/$2"
9b2f7e
				echo "linking $1 to $2"
9b2f7e
				ln -s ${SCL_JAVA_DIR}/$2 ${_f%.jar}.jar
9b2f7e
				return 0
9b2f7e
			fi
9b2f7e
		done
9b2f7e
		echo "not found $2 in any of ${SCL_JAVA_DIRS}"
9b2f7e
		exit 1
9b2f7e
	fi
9b2f7e
}
9b2f7e
9b2f7e
# pushd $1
9b2f7e
# 	_symlink javax.annotation-api_ glassfish-annotation-api.jar
9b2f7e
9b2f7e
# 	_symlink com.sun.el.javax.el_ glassfish-el.jar
9b2f7e
# 	_symlink javax.el-api_ glassfish-el-api.jar
9b2f7e
9b2f7e
# 	_symlink javax.inject_ atinject.jar
9b2f7e
9b2f7e
# 	_symlink javax.servlet.jsp_ glassfish-jsp-api/javax.servlet.jsp-api.jar
9b2f7e
# 	_symlink javax.servlet-api_ glassfish-servlet-api.jar
9b2f7e
9b2f7e
# 	_symlink org.apache.commons.codec_ commons-codec.jar
9b2f7e
# 	_symlink org.apache.commons.io_ commons-io.jar
9b2f7e
# 	_symlink org.apache.commons.jxpath_ commons-jxpath.jar
9b2f7e
# 	_symlink org.apache.commons.logging_ commons-logging.jar
9b2f7e
9b2f7e
# 	_symlink org.apache.httpcomponents.httpcore_ httpcomponents/httpcore.jar
9b2f7e
# 	_symlink org.apache.httpcomponents.httpclient_ httpcomponents/httpclient.jar
9b2f7e
9b2f7e
# 	_symlink org.tukaani.xz_ xz-java.jar
9b2f7e
# 	_symlink org.w3c.dom.svg_ xml-commons-apis-ext.jar
9b2f7e
# 	_symlink org.xmlpull_ xpp3.jar
9b2f7e
# popd