Blame SOURCES/symlink_libs.sh

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