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