Blame SOURCES/symlink_libs.sh

08559d
#!/bin/bash
08559d
08559d
# This script replaces plugins with symlinks
08559d
# $1 : folder to replace with symlinks
08559d
08559d
set -e
08559d
08559d
SCL_JAVA_DIRS=${@:2}
08559d
08559d
pushd () {
08559d
	command pushd "$@" > /dev/null
08559d
}
08559d
08559d
popd () {
08559d
	command popd "$@" > /dev/null
08559d
}
08559d
08559d
function _sym {
08559d
	if [ -f $1 ]; then
08559d
		echo "linking $1 to $2"
08559d
		rm -rf $1
08559d
		ln -s $2 $1
99c80f
	else
08559d
		echo "Failed to find $1"
08559d
		ls -l
08559d
		exit 1
08559d
	fi
08559d
}
08559d
08559d
function _symlink {
08559d
	_f=$(ls | grep -e "^$1" || :)
08559d
	if [ -n "$_f" ] ; then
08559d
		rm -rf $_f
08559d
		for SCL_JAVA_DIR in ${SCL_JAVA_DIRS}; do
08559d
			if [ -f ${SCL_JAVA_DIR}/$2  ]; then
99c80f
				echo "linking ${_f%.jar}.jar to ${SCL_JAVA_DIR}/$2"
08559d
				ln -s ${SCL_JAVA_DIR}/$2 ${_f%.jar}.jar
08559d
				return 0
08559d
			fi
08559d
		done
08559d
		echo "not found $2 in any of ${SCL_JAVA_DIRS}"
08559d
		exit 1
08559d
	fi
08559d
}
08559d
99c80f
pushd $1
99c80f
	# owasp-java-encoder
99c80f
	_sym org.owasp.encoder_1.2.2.jar /usr/share/java/owasp-java-encoder/encoder.jar
99c80f
	# jaf
99c80f
	_sym com.sun.activation.jakarta.activation_1.2.1.jar /usr/share/java/jaf/jakarta.activation.jar
99c80f
	_sym jakarta.activation-api_1.2.1.jar /usr/share/java/jaf/jakarta.activation-api.jar
99c80f
	# HdrHistogram
99c80f
	_sym org.hdrhistogram.HdrHistogram_2.1.11.jar /usr/share/java/HdrHistogram.jar
99c80f
	# jmc-core
99c80f
	_symlink org.openjdk.jmc.common_ common.jar
99c80f
	_symlink org.openjdk.jmc.flightrecorder_ flightrecorder.jar
99c80f
	_symlink org.openjdk.jmc.flightrecorder.rules_ flightrecorder.rules.jar
99c80f
	_symlink org.openjdk.jmc.flightrecorder.rules.jdk_ flightrecorder.rules.jdk.jar
99c80f
popd