2013-10-29 20:04:55 +01:00
|
|
|
#!/bin/sh -ex
|
|
|
|
|
2013-11-01 20:54:41 +01:00
|
|
|
GITID=$(git rev-parse HEAD)
|
|
|
|
|
2013-11-06 19:15:04 +01:00
|
|
|
if [ "$(uname)" = "Darwin" ]; then
|
2013-11-12 18:23:15 +01:00
|
|
|
TMPDIR=/tmp/enterprise-build
|
2013-11-06 19:15:04 +01:00
|
|
|
rm -Rf $TMPDIR
|
|
|
|
mkdir -p $TMPDIR
|
|
|
|
else
|
|
|
|
TMPDIR=$(mktemp -d)
|
|
|
|
fi
|
|
|
|
|
2013-11-12 17:13:19 +01:00
|
|
|
TMP_CHECKOUT=$TMPDIR/zulip-server/
|
|
|
|
TARBALL=$TMPDIR/zulip-server.tar
|
2013-11-01 20:54:41 +01:00
|
|
|
|
2013-11-12 17:13:19 +01:00
|
|
|
# .gitattributes lists the files that are not exported
|
|
|
|
git archive -o $TARBALL --prefix=zulip-server/ HEAD
|
2013-11-01 20:54:41 +01:00
|
|
|
|
2013-11-12 17:13:19 +01:00
|
|
|
# Check out a temporary full copy of the index to generate static files
|
|
|
|
git checkout-index -f -a --prefix $TMP_CHECKOUT
|
|
|
|
cd $TMP_CHECKOUT
|
2013-11-01 20:54:41 +01:00
|
|
|
|
2013-11-12 20:37:23 +01:00
|
|
|
# Use default settings so there is no chance of leaking secrets
|
|
|
|
cp zproject/local_settings_template.py zproject/local_settings.py
|
|
|
|
|
|
|
|
# Some settings need values for it to work
|
|
|
|
cat >> zproject/local_settings.py <<EOF
|
|
|
|
DEBUG = False
|
|
|
|
LOCAL_DATABASE_PASSWORD = ''
|
|
|
|
SECRET_KEY = 'not_used_here'
|
|
|
|
EOF
|
|
|
|
|
2013-11-01 20:54:41 +01:00
|
|
|
# update-prod-static generates the prod-static directory.
|
|
|
|
# See COLLECTSTATIC in settings.py
|
|
|
|
./tools/update-prod-static
|
|
|
|
echo $GITID > version_id
|
|
|
|
mv update-prod-static.log ..
|
|
|
|
|
2013-11-12 17:13:19 +01:00
|
|
|
cd $TMPDIR
|
|
|
|
|
|
|
|
tar --append -f $TARBALL zulip-server/prod-static zulip-server/version_id
|
2013-11-01 20:54:41 +01:00
|
|
|
|
|
|
|
rm -r zulip-server
|
2013-11-12 17:13:19 +01:00
|
|
|
|
|
|
|
gzip $TARBALL
|
|
|
|
echo "Generated $TARBALL.gz"
|