SHARE
TWEET

jarsToSkip List Generator

a guest Jul 17th, 2018 144 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2.  
  3. set -o errexit
  4. set -o nounset
  5. set -o pipefail
  6.  
  7. # .tld
  8. # META-INF/web-fragment.xml
  9.  
  10. function main {
  11.   tomcat_home=$1
  12.   local jar_without_tld_list=
  13.  
  14.   for f in $(find ${tomcat_home} -name "*.jar"); do
  15.     printf "%-60s" "Checking $(basename $f): "
  16.     if [[ $(unzip -v ${f} | grep -E '.tld$|web-fragment.xml$' | wc -l) -eq 0 ]]; then
  17.       printf "%-60s\n" "[Added]"
  18.       jar_without_tld_list="${jar_without_tld_list}$(basename $f)\n"
  19.     else
  20.       printf "%-60s\n" "[NOT Added]"
  21.     fi
  22.   done
  23.  
  24.   local result=
  25.   for el in $(echo -e "$jar_without_tld_list" | sort -u); do
  26.     if [ -n "${result}" ]; then
  27.       result="${result},${el}"
  28.     else
  29.       result="${el},"
  30.     fi
  31.   done
  32.  
  33.   echo "${result}"
  34. }
  35.  
  36. main "$@"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top