Skip to content

Instantly share code, notes, and snippets.

@667bdrm
Created January 14, 2012 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 667bdrm/1611787 to your computer and use it in GitHub Desktop.
Save 667bdrm/1611787 to your computer and use it in GitHub Desktop.
Drupal package builer with optional upload to SourceForge
#!/bin/sh
BRANCHES="7.x-2.x 6.x-2.x 7.x-1.x 6.x-1.x"
LIBBRANCHES="2.x"
export NODE_PATH=/usr/lib/node_modules
if [ ! -d "elfinder" ] ; then
git clone http://git.drupal.org/project/elfinder.git
cd elfinder
for i in $BRANCHES
do
git checkout --track origin/$i
done
cd ..
fi
PWD=`pwd`
function updateinfo() {
echo $1
}
export -f updateinfo
ts=`date +%Y%m%d_%H%M%S`
for i in $BRANCHES
do
cd elfinder
git checkout $i
lastremote=`git ls-remote origin -h refs/heads/$i | grep -Po "^[a-f0-9]\w*"`
lastlocal=`git rev-parse $i`
echo "$i : latest $lastremote your $lastlocal"
if [[ "$lastremote" != "$lastlocal" && "$lastlocal" != "" ]] ; then
echo "$i need update"
git pull origin $i
distname=elfinder-$i-$ts
git archive $i --format tar --prefix elfinder/ -o ../$distname.tar
cd ..
tar xf $distname.tar -C tmp
rm -f $distname.tar
VER=$i-dev-$ts
CORE=`echo $i | cut -f1 -d -`
TIME=`date +%s`
data="; ph0enix build script\nversion = \""$VER"\"\ncore = \""$CORE"\"\nproject = \"elfinder\"\ntimestamp = \""$TIME"\"\n"
for j in `find tmp -name *.info`
do
echo -e $data >> $j
done
arc=$PWD/$distname.tar.gz
tar zcf $arc -C tmp elfinder
majorver=`echo $i | cut -f1 -d .`
# scp -i ~/.ssh/user@sourceforge $arc user@frs.sourceforge.net:"/home/frs/project/d/dr/drupal-elfinder/Drupal\\ $majorver/"
rm -rf tmp/*
else
cd ..
fi
done
if [ ! -d "elfinder-lib" ] ; then
git clone https://github.com/Studio-42/elFinder.git elfinder-lib
cd elfinder-lib
for i in $LIBBRANCHES
do
git checkout --track origin/$i
done
cd ..
fi
for i in $LIBBRANCHES
do
cd elfinder-lib
git checkout $i
lastremote=`git ls-remote origin -h refs/heads/$i | grep -Po "^[a-f0-9]\w*"`
lastlocal=`git rev-parse $i`
echo "$i : latest $lastremote your $lastlocal"
if [[ "$lastremote" != "$lastlocal" && "$lastlocal" != "" ]] ; then
git pull origin $i
mkdir -p ../tmp/elfinder-lib/elfinder
jake -C ../tmp/elfinder-lib/elfinder elfinder
cd ..
arc=$PWD/elfinder-lib-$i-$ts.tar.gz
tar zcf $arc -C tmp/elfinder-lib elfinder
#scp -i ~/.ssh/user@sourceforge $arc user@frs.sourceforge.net:"/home/frs/project/d/dr/drupal-elfinder/Library/"
rm -rf tmp/*
else
cd ..
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment