#!/bin/bash # Script to generate distribution builds of LifeType # # (c) 27-08-2004, the LifeType Team # # # Requires two parameters: the name of the output package and the # CVS tag label that will be used to fetch the contents of the build. Therefore, # contents must be tagged _before_ running this script. # The same CVS label must be used for both the plog_devel and plog_docs module. # # # server and repository path # SVNSERVER=http://devel.lifetype.net SVNREPO=/svn/plog/plog # # array with the files that we are going to remove before # making the package... Wildcards, complete paths, whatever # can be used here # NOTE: When changing this list, update the list in build-diff.sh as well TOREMOVE="include_files release/ locale/unported/ templates/LifeType/ templates/standard-with-plugins/ templates/grey-sf/ templates/plogworld docs-devel/ class/gallery/getid3/module.archive.rar.php class/gallery/getid3/module.archive.szip.php class/gallery/getid3/module.audio-video.bink.php class/gallery/getid3/module.audio-video.matroska.php class/gallery/getid3/module.audio-video.nsv.php class/gallery/getid3/module.audio.avr.php class/gallery/getid3/module.audio.bonk.php class/gallery/getid3/module.audio.la.php class/gallery/getid3/module.audio.lpac.php class/gallery/getid3/module.audio.monkey.php class/gallery/getid3/module.audio.optimfrog.php class/gallery/getid3/module.audio.rkau.php class/gallery/getid3/module.audio.shorten.php class/gallery/getid3/module.audio.tta.php class/gallery/getid3/module.audio.voc.php class/gallery/getid3/module.audio.vqf.php class/gallery/getid3/module.graphic.bmp.php class/gallery/getid3/module.graphpc.pcd.php class/gallery/getid3/module.misc.exe.php class/gallery/getid3/module.misc.iso.php class/gallery/getid3/extension.cache.dbm.php class/gallery/getid3/extension.cache.mysql.php class/gallery/getid3/write.apetag.php class/gallery/getid3/write.id3v1.php class/gallery/getid3/write.id3v2.php class/gallery/getid3/write.lyrics3.php class/gallery/getid3/write.metaflac.php class/gallery/getid3/write.php class/gallery/getid3/write.real.php class/gallery/getid3/write.vorbiscomment.php dbperf.php *.xcode tools/ runtests.php class/test/" # # helper functions to print things in different colors # NOCOLOR='\e[0m' message() { echo -e "\033[01;32m$*$NOCOLOR" } warning() { echo -e "\033[01;33m$*$NOCOLOR" } error() { echo -e "\033[01;31m$*$NOCOLOR" } find_phpcli() { if [ -x /usr/bin/php5 ]; then PHP=/usr/bin/php5 else PHP=/usr/bin/php fi } # check parameters if [ $# -lt 1 ]; then echo "Makes a build off the latest SVN source code and packages it" echo "" echo "Usage: $0 label package-name" echo "" echo "If package-name is omitted, the name will be lifetype-devel-" echo "" echo "Use HEAD or TRUNK to indicate the main development branch" echo "" echo "Example:" echo "" echo " $0 tags/lifetype-1.2.6 lifetype-1.2.6" exit -1 fi SVNTAG=$1 # if there was no package name parameter, then build one using the current date if [ $# -eq 1 ]; then PACKAGENAME=lifetype-devel-`date +%Y%m%d` else PACKAGENAME=$2 fi message "Using $PACKAGENAME as the package name" WORKDIR=`basename $PACKAGENAME` BUILDLABEL=`basename $PACKAGENAME` # determine whether code should be fetched from # plog/trunk or plog/tags/xxxx if [ $SVNTAG == "HEAD" -o $SVNTAG == "TRUNK" -o $SVNTAG == "head" -o $SVNTAG == "trunk" ]; then SVNREPO=${SVNREPO}/trunk else SVNREPO=${SVNREPO}/${SVNTAG} fi # call the svn command with the correct parameters message "Fetching the source code using $SVNTAG label..." REV=`svn export $SVNSERVER$SVNREPO $WORKDIR | tail -n 1 | awk '{print $NF}' | tr -d . ` if [ $? -eq 1 ]; then echo "There was an error fetching the source code. Please try again." exit 1 fi # create the temp folder and give proper permissions to it message "Creating the temporary folders and setting permissions to 777..." if [ \! -d $WORKDIR/tmp ]; then mkdir $WORKDIR/tmp fi chmod 777 $WORKDIR/tmp # create the gallery/ folder and make sure that it has the right permissions message "Creating the gallery/ folder and setting permissions to 777..." if [ \! -d $WORKDIR/gallery ]; then mkdir $WORKDIR/gallery fi chmod 777 $WORKDIR/gallery # copy the generic config file and remove the dist/ folder since it is not needed message "Copying the default config files..." cp -f $WORKDIR/release/config.properties.php.dist $WORKDIR/config/config.properties.php cp -f $WORKDIR/release/logging.properties.php.dist $WORKDIR/config/logging.properties.php cp -f $WORKDIR/release/cache.properties.php.dist $WORKDIR/config/cache.properties.php cp -f $WORKDIR/release/userdata.properties.php.dist $WORKDIR/config/userdata.properties.php rm -rf $WORKDIR/release # regular users want to use the wizard mv $WORKDIR/wizard $WORKDIR/wizard.php # update the version.php file message "Updating the version.php file..." VERNAME=`basename ${SVNTAG}` echo " $WORKDIR/version.php echo "\$version = \"${VERNAME}_r${REV}\";" >> $WORKDIR/version.php echo "?>" >> $WORKDIR/version.php # and remove all unnecessary files message "Removing unnecessary files..."; for i in $TOREMOVE do echo " -- removing $i" rm -rf $WORKDIR/$i done # generate install/file.properties.php with the MD5 hashes of most core files find_phpcli message "Generating MD5 hashes (using $PHP)..." $PHP $WORKDIR/bin-devel/genmd5.php # remove the bin-devel/ folder, we don't need it anymore rm -rf $WORKDIR/bin-devel # and create the .zip, tar.gz and .tar.bz2 packages message "Creating .zip package..." zip $BUILDLABEL.zip -r $WORKDIR > /dev/null message "Creating .tar.gz package..." tar czvf $BUILDLABEL.tar.gz $WORKDIR > /dev/null message "Creating .tar.bz2 package..." tar cjvf $BUILDLABEL.tar.bz2 $WORKDIR > /dev/null # calculate branch and version LTBRANCH=`echo $VERNAME | sed 's_lifetype-\(.*\..*\)\.\(.*\)_\1_'` LTVERSION=`echo $VERNAME | sed 's_lifetype-\(.*\)_\1_'` # create the lifetype core version feed xml file echo " Lifetype version feed http://www.lifetype.net This feed contains the latest Lifetype version available lifetype-${LTVERSION}_r${REV} http://downloads.sourceforge.net/lifetype/lifetype-${LTVERSION}.zip The Lifetype project Lifetype ${LTVERSION} ${LTVERSION}_r${REV} 0 ${LTBRANCH} http://wiki.lifetype.net/index.php/Release_notes_Lifetype_${LTVERSION} " > lifetype.xml # clean up the temporary folders message "Cleaning up..." rm -rf $WORKDIR # done! message "Done!"