| #!/usr/bin/env bash |
| # script to copy update jars from their staging area to the releases 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=${stagingDirectory} |
| toDirectory=${releaseDirectory} |
| |
| 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}/aggregate ${toDirectory} |
| |
| # composite artifact and content files |
| rsync -vup ${fromDirectory}/*.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 |
| |
| # assumes the "promoteToStaging" script has ran |
| fromString="/releases/staging" |
| |
| # First do the index.php file, which just mentions update site (top level) |
| toString="/releases/galileo" |
| replaceCommand="s!${fromString}!${toString}!g" |
| echo "replaceCommand: ${replaceCommand}" |
| perl -pi -w -e ${replaceCommand} ${toDirectory}/*.php |
| # then the lines for 'mirror' |
| 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 |
| # is done already in promote to staging. |
| |