Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Requirements
- PROGS=("xmlstarlet")
- for PROG in "${PROGS[@]}" ; do
- command -v $PROG >/dev/null 2>&1 || { echo >&2 "System requirement $PROG not met. Please install $PROG"; exit 1; }
- done
- # Sanity
- if [[ "$1" == "" ]] ; then
- JENKINS_PLUGIN_DIR="/var/lib/jenkins/plugins"
- else
- JENKINS_PLUGIN_DIR="$1"
- fi
- if [ ! -d $JENKINS_PLUGIN_DIR ] ; then
- echo "Jenkins plugin directory is not a directory: ${JENKINS_PLUGIN_DIR}"
- exit 1
- fi
- SPACES=$(printf "%0.s " {1..2})
- # Process
- echo "initial:"
- for LIC in `ls -1 $JENKINS_PLUGIN_DIR/*/WEB-INF/licenses.xml` ; do
- ART_ID=$(cat "${LIC}" | xmlstarlet sel -t -v '/l:dependencies/@artifactId')
- VER_ID=$(cat "${LIC}" | xmlstarlet sel -t -v '/l:dependencies/@version')
- printf '%s- name: "%s"\n' "${SPACES}" "${ART_ID}"
- printf '%s version: "%s"\n' "${SPACES}" "${VER_ID}"
- done
Add Comment
Please, Sign In to add comment