blob: 36472115a61cb09779263b780003b4ecdc3b6167 [file] [log] [blame]
#!/usr/bin/env bash
# script to copy update jars from their working area to the staging area
# finds file on users path, before current directory
# hence, non-production users can set their own values for test machines
source galileo_properties.shsource
fromDirectory=${BUILD_RESULTS}
toDirectory=${stagingDirectory}
echo ""
echo " Removing previous staging directory files at"
echo " "${toDirectory}
echo ""
# make sure 'toDirectory' has been defined and is no zero length, or
# else following will eval to "rm -fr /*" ... potentially catastrophic
if [ -z "${toDirectory}" ]
then
echo "The variable toDirectory must be defined to run this script"
exit 1;
fi
if [ -d ${toDirectory} ]
then
rm -fr "${toDirectory}"/*
fi
echo ""
echo " Copying new plugins and features "
echo " from ${fromDirectory}"
echo " to ${toDirectory}"
echo ""
# plugins and features
rsync -rvup ${fromDirectory}/final/aggregate ${toDirectory}
# composite artifact and content files
rsync -vup ${fromDirectory}/final/*.jar ${toDirectory}
# log and index page
rsync -vup ${fromDirectory}/*.php ${toDirectory}
rsync -vup ${fromDirectory}/*.txt ${toDirectory}
if [[ $FIXUP_URLS ]]
then
# now correct the URLs
unzip ${toDirectory}/content.jar -d ${toDirectory}
unzip ${toDirectory}/aggregate/artifacts.jar -d ${toDirectory}/aggregate
# currently a quirk of build system, file references in working directory
# are to "/releases/galileo" (even though that's not where they are)
fromString="/releases/galileo"
# First do the index.php file, which just mentions update site (top level)
toString="/releases/staging"
replaceCommand="s!${fromString}!${toString}!g"
echo "replaceCommand: ${replaceCommand}"
perl -pi -w -e ${replaceCommand} ${toDirectory}/*.php
perl -pi -w -e ${replaceCommand} ${toDirectory}/aggregate/artifacts.xml
perl -pi -w -e ${replaceCommand} ${toDirectory}/content.xml
# rezip our modified versions
zip -Djm ${toDirectory}/aggregate/artifacts.jar ${toDirectory}/aggregate/artifacts.xml
zip -Djm ${toDirectory}/content.jar ${toDirectory}/content.xml
fi
# obfuscate email addresses
fromString="mailto:(.*)@"
toString="mailto:"'$1'"<at>"
replaceCommand="s!$fromString!$toString!"
echo "replaceCommand: $replaceCommand"
pexec=`echo "perl -pi -w -e " $replaceCommand "${toDirectory}/*.php"`
echo "$pexec"
perl -pi -w -e $replaceCommand "${toDirectory}/*.php"
# remove lock file from hundson build's "pauseAll.sh" script once we are all done
rm -v "${BUILD_HOME}"/lockfile