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
6842c8
	else
9b2f7e
		echo "Failed to find $1"
9b2f7e
		ls -l
9b2f7e
		exit 1
9b2f7e
	fi
9b2f7e
}
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
6842c8
				echo "linking ${_f%.jar}.jar to ${SCL_JAVA_DIR}/$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
6842c8
pushd $1
6842c8
	# owasp-java-encoder
6842c8
	_sym org.owasp.encoder_1.2.2.jar /usr/share/java/owasp-java-encoder/encoder.jar
6842c8
	# jakarta-activation
6842c8
	_sym com.sun.activation.jakarta.activation_1.2.1.jar /usr/share/java/jaf/jakarta.activation.jar
6842c8
	# HdrHistogram
6842c8
	_sym org.hdrhistogram.HdrHistogram_2.1.11.jar /usr/share/java/HdrHistogram.jar
6842c8
    # jmc-core
6842c8
	_symlink org.openjdk.jmc.common_ common.jar
6842c8
	_symlink org.openjdk.jmc.flightrecorder_ flightrecorder.jar
6842c8
	_symlink org.openjdk.jmc.flightrecorder.rules_ flightrecorder.rules.jar
6842c8
	_symlink org.openjdk.jmc.flightrecorder.rules.jdk_ flightrecorder.rules.jdk.jar
6842c8
popd