Skip to content

Instantly share code, notes, and snippets.

@stgnet
Created April 1, 2014 15:17
Show Gist options
  • Save stgnet/9916277 to your computer and use it in GitHub Desktop.
Save stgnet/9916277 to your computer and use it in GitHub Desktop.
Build FreePBX module tgz for testing
#!/bin/bash
# build test version of module
set -e
[ ! -f module.xml ] && echo "ERROR: module.xml not found!" && exit 1
MODNAME=$(xmllint --shell module.xml <<<"cat /module/rawname/text()" |grep -v "^/")
VERSION=$(xmllint --shell module.xml <<<"cat /module/version/text()" |grep -v "^/")
[ -z "$MODNAME" -o -z "$VERSION" ] && echo "ERROR: module name and version missing from module.xml" && exit 2
cd ..
[ ! -d "$MODNAME" ] && echo "ERROR: directory $PWD/$MODNAME not found!" && exit 3
tar cvfz $MODNAME-$VERSION.tgz --exclude .git $MODNAME
echo "Built module for testing: $(readlink -f $MODNAME-$VERSION.tgz)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment