Skip to content

Instantly share code, notes, and snippets.

@NetzwergX
Last active December 16, 2015 18:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetzwergX/5476496 to your computer and use it in GitHub Desktop.
Save NetzwergX/5476496 to your computer and use it in GitHub Desktop.
Build script for WoltLab Community Framework (WCF) packages Automagically builds packages that obey the standard package structure.
#!/bin/bash
#
# Build script for WoltLab Community Framework (WCF) packages
# by Sebastian Teumert (http://www.teumert.net, http://github.com/NetzwergX)
# clear
if ls *.tar > /dev/null 2>&1
then
rm *.tar
fi
packageDir=`pwd`
package=`basename ${packageDir}`
# pack xml files
tar cvf ${package}.tar *.xml
# pack language files
if ls language > /dev/null 2>&1
then
tar -rvf ${package}.tar language/ --exclude-vcs --exclude-backups
fi
# pack sql files
if ls *.sql > /dev/null 2>&1
then
tar -rvf ${package}.tar *.sql --exclude-vcs --exclude-backups
fi
# pack php files
if ls *.php > /dev/null 2>&1
then
tar -rvf ${package}.tar *.php --exclude-vcs --exclude-backups
fi
# pack optionals
if ls optionals > /dev/null 2>&1
then
tar -rvf ${package}.tar optionals/ --exclude-vcs --exclude-backups
fi
# pack requirements
if ls requirements > /dev/null 2>&1
then
tar -rvf ${package}.tar requirements/ --exclude-vcs --exclude-backups
fi
# build file-based PIPs
for dir in */;
do
if [ "${dir}" = 'language/' ] || [ "${dir}" = 'optionals/' ] || [ "${dir}" = 'requirements/' ];
then
continue
else
cd ${dir} && tar cvf ../`basename ${dir}`.tar * --exclude-vcs --exclude-backups > /dev/null 2>&1 && cd ..
tar -rvf ${package}.tar `basename ${dir}`.tar --exclude-vcs --exclude-backups
rm `basename ${dir}`.tar
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment