Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
William-Hill committed Aug 18, 2017
1 parent 6872002 commit 7cbbac8
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions create_esgf_tarballs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ quotedsr=`echo "$replace_release" | sed 's/[./*?|]/\\\\&/g'`;
quotedmj=`echo $replace_script_maj_version|sed 's/[./*?|]/\\\\&/g'`;

echo -n >listoffiles;
#Create dictionary of components
declare -A components
components[esgf-dashboard]='bin/esg-dashboard dist/esgf_dashboard-0.0.2-py2.7.egg INSTALL README LICENSE'
components[esgf-desktop]='bin/esg-desktop INSTALL README LICENSE'
Expand All @@ -33,53 +34,78 @@ components[esgf-product-server]='esg-product-server'
components[filters]='esg-access-logging-filter esg-drs-resolving-filter esg-security-las-ip-filter esg-security-tokenless-filters'
components[esgf-cog]='esg-cog'
components[esgf-stats-api]='bin/esg_stats-api_v2 dist/esgf-stats-api.war'

#Delete esgf_tarballs and temp-dists directories
rm -rf esgf_tarballs
rm -rf temp-dists

#Recreate esgf_tarballs and temp-dists directories
mkdir esgf_tarballs
mkdir temp-dists

#Make product-server, filters, and esgf-cog directory
mkdir esgf-product-server 2>/dev/null
mkdir filters 2>/dev/null
mkdir esgf-cog 2>/dev/null

#Copy product-server, esg-cog, and filters from esgf-installer to their own respective directories
cp esgf-installer/product-server/* esgf-product-server/
cp esgf-installer/cog/esg-cog esgf-cog
cp esgf-installer/filters/* filters/

for i in "${!components[@]}"; do
if [ ! -d $i ]; then
echo "Directory $i not found. Bailing out.";
continue;
fi
#Copy the dist directory of a repo to temp-dists; The dist directory contains the jars,wars, and egg files
cp $i/dist/* temp-dists;
#Remove the ivy* files from temp-dists that just got copied over
rm temp-dists/ivy*.xml;

for file in ${components[$i]}; do
if [ ! -e $i/$file ]; then
echo "File $i/$file not found";
continue;
else
echo "File $i/$file OK";
cp $i/$file temp-dists
#Copy file to temp-dists
#TODO: mkdir -p temp-dists/$i
cp $i/$file temp-dists/
fi
done
cd temp-dists;
for f in `ls`; do

cd temp-dists || exit;

for f in *; do
#if file is a md5 hash; bypass it if so
if echo $f|grep md5 >/dev/null; then
echo "Skipping md5 file"
continue;
else
if [ "$f" = "esg-node" ]; then
echo "Found esg-node"
sed -i .backup "s/\(script_version=\"$quotedsv\"\)/script_version=\"$script_version\"/" esg-node;
sed -i .backup "s/\(script_release=\"$quotedsr\"\)/script_release=\"$script_release\"/" esg-node;
sed -i .backup "s/\(script_maj_version=\"$quotedmj\"\)/script_maj_version=\"$script_maj_version\"/" esg-node;
fi
if [ "$f" = "esg-bootstrap" ]; then
echo "Found esg-bootstrap"
sed -i .backup "s/\(script_maj_version=\"$quotedmj\"\)/script_maj_version=\"$script_maj_version\"/" esg-bootstrap;
fi
#Create md5sum of file
md5sum $f >$f.md5;
fi
done

#If inside esgf-installer directory, create script_maj_version subdirectory
if [ "$i" = "esgf-installer" ]; then
echo "Found esgf-installer"
mkdir $script_maj_version;
mv esg-node* jar_security_scan* setup-autoinstall* esg-purge.sh* esg-init* esg-functions* esg-bootstrap* esg-autoinstall* esg-autoinstall.template $script_maj_version/;
fi


tar -czf $i-dist.tgz *;
mv $i-dist.tgz ../esgf_tarballs
cd ..
Expand Down

0 comments on commit 7cbbac8

Please sign in to comment.