| #!/bin/sh |
| workingDir=/home/data/httpd/download.eclipse.org/scout |
| stagingArea=$workingDir/stagingArea |
| repositoriesDir=$workingDir |
| stageTriggerFileName=doStage |
| |
| |
| processZipFile() |
| { |
| backupDir=$(pwd) |
| zipFile=$backupDir"/"${1%?} |
| sigOk=$2 |
| if [ $sigOk == OK ]; then |
| echo $(date)" publish $zipFile" |
| mkdir $stagingArea/working |
| unzip $zipFile -d $stagingArea/working >$stagingArea/NUL |
| chgrp -R technology.scout $stagingArea/working |
| chmod -R g+w $stagingArea/working |
| |
| cd $stagingArea/working |
| for d in {[0-9\.]*,nightly} |
| do |
| if [ -d "$d" ]; then |
| if [ -d $repositoriesDir/$d""_new ]; then |
| rm -rf $repositoriesDir/$d""_new |
| fi |
| mv $stagingArea/working/$d $repositoriesDir/$d""_new |
| # backup original |
| if [ -d $repositoriesDir/$d ]; then |
| if [ -d $repositoriesDir/$d""_backup ]; then |
| rm -rf $repositoriesDir/$d""_backup |
| fi |
| cp -r $repositoriesDir/$d $repositoriesDir/$d""_backup |
| fi |
| # copy new repository |
| cp -f $repositoriesDir/$d""_new/*.jar $repositoriesDir/$d |
| cp -rf $repositoriesDir/$d""_new/N* $repositoriesDir/$d |
| rm -rf $repositoriesDir/$d""_new |
| fi |
| done |
| |
| ## remove old nightly repositories that are not contained in the composite updateiste |
| cd $workingDir/nightly |
| unzip compositeContent.jar |
| for sub in N* |
| do |
| if [ -d "$sub" ]; then |
| if ! (grep -q "$sub" compositeContent.xml); |
| then |
| echo "$sub is not contained in composite. Removing.."; |
| rm -rf $sub |
| fi |
| fi |
| done |
| rm compositeContent.xml |
| cd $stagingArea/working |
| |
| #cleanup stagingArea |
| cp $stagingArea/working/*.xml $repositoriesDir/ |
| rm -rf $stagingArea/working |
| cd $backupDir |
| else |
| echo "md5 not valid for $zipFile!" |
| fi |
| } |
| |
| |
| if [ -f $stagingArea/$stageTriggerFileName ]; then |
| backupDir=$(pwd) |
| cd $stagingArea |
| mv $stagingArea/$stageTriggerFileName $stagingArea/processing |
| processZipFile $(md5sum -c $stagingArea/processing) |
| rm -rf $stagingArea/* |
| cd $backupDir |
| fi |
| |
| #echo $stagingArea/stage.zip |
| #username=$(ls -l $stagingArea/stage.zip | awk '{print $3}') |
| #if [ "$username" == "aho" ]; then |