#!/bin/sh BUNDLEURL=$1 GROUPID=$2 VERSION=$3 [ "${BUNDLEURL}" = "" ] && echo && echo "You must specify a bundle URL!" && echo && exit WORKDIR=bundle.tmp # repo dir relative to WORKDIR REPODIR=$HOME/repository-staging/to-ibiblio/maven rm -rf $WORKDIR > /dev/null 2>&1 mkdir $WORKDIR cd $WORKDIR wget $BUNDLEURL BUNDLE=`echo $BUNDLEURL | sed -e 's#^.*/##;'` echo $BUNDLE ( jar xf $BUNDLE # copy files in subdirs to workdir for d in `find ./* -type d` ; do for f in `find $d -type f` ; do cp $f .; done; done POM=project.xml if [ ! -f ${POM} ] then POM=pom.xml fi [ ! -f ${POM} ] && echo && echo "Cannot deploy without the pom.xml or project.xml file!" && echo && exit less $POM ../d2u ${POM} if [ ! -z $VERSION ] then version=$VERSION else version=`cat ${POM} | tr '\n' ' ' | sed 's#.*##' | sed 's#.*##' | sed 's#.*##' | grep '' | sed -e 's#^.*##;s#.*$##'` if [ -z $version ] then version=`grep currentVersion ${POM} | sed -e 's/^ *//;s///;s/<\/currentVersion>//'` fi fi artifactId=`cat ${POM} | tr '\n' ' ' | sed 's#.*##' | sed 's#.*##' | sed 's#.*##' | sed 's#.*##' | grep '' | sed -e 's#^.*##;s#.*$##'` if [ -z $artifactId ] then artifactId=`cat ${POM} | tr '\n' ' ' | sed 's#.*##' | sed 's#.*##' | sed 's#.*##' | sed 's#.*##' | sed 's#.*##' | grep '' | sed -e 's#^.*##;s#.*$##'` fi if [ ! -z $GROUPID ] then groupId=${GROUPID} else groupId=`cat ${POM} | tr '\n' ' ' | sed 's#.*##' | sed 's#.*##' | grep '' | sed -e 's#^.*##;s#.*$##'` if [ -z $groupId ] then groupId=${artifactId} fi fi version=`echo ${version} | sed -e 's/ *$//'` artifactId=`echo ${artifactId} | sed -e 's/ *$//'` groupId=`echo ${groupId} | sed -e 's/ *$//'` echo echo " version: [${version}]" echo " groupId: [${groupId}]" echo "artifactId: [${artifactId}]" echo if [ -d $REPODIR/${groupId} ] then echo "The group already exists" else echo "The group does NOT already exist" fi echo echo -n Hit Enter to continue or Ctrl-C to abort... read LIC=LICENSE.txt # A little help for manually created upload bundles [ -f license.txt ] && mv license.txt $LIC [ -f licence.txt ] && mv licence.txt $LIC [ ! -f $LIC ] && echo && echo "Cannot deploy without the $LIC file!" && echo && exit cp ${POM} ${artifactId}-${version}.pom ../d2u $LIC mkdir -p $REPODIR/${groupId}/licenses cp -i $LIC $REPODIR/${groupId}/licenses/${artifactId}-${version}.license mkdir -p $REPODIR/${groupId}/poms cp -i ${artifactId}-${version}.pom $REPODIR/${groupId}/poms artifactType=`echo ${artifactId} | sed -e 's/maven-.*-plugin//'` if [ -z ${artifactType} ] then echo "Deploying Plugin ..." mkdir -p $REPODIR/${groupId}/plugins cp -i ${artifactId}-${version}.jar $REPODIR/${groupId}/plugins else echo "Deploying JAR ..." mkdir -p $REPODIR/${groupId}/jars cp -i ${artifactId}-${version}.jar $REPODIR/${groupId}/jars fi if [ -f ${artifactId}-${version}-sources.jar ] then echo "Deploying Java sources ..." mkdir -p $REPODIR/${groupId}/java-sources cp -i ${artifactId}-${version}-sources.jar $REPODIR/${groupId}/java-sources else echo "No Java sources available in upload bundle, skipping ..." fi )