#!/bin/sh
#
# Copyright © 2014 Daniel Tschan <tschan@puzzle.ch>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# Don't let OpenShift install weblate and its dependencies directly as this leads to timeouts during gear creation and deploys
if [ -e $OPENSHIFT_REPO_DIR/setup.py ]; then
  mv $OPENSHIFT_REPO_DIR/setup.py $OPENSHIFT_REPO_DIR/setup_weblate.py
fi

if [ -e $OPENSHIFT_REPO_DIR/requirements.txt ]; then
	mv $OPENSHIFT_REPO_DIR/requirements.txt $OPENSHIFT_REPO_DIR/requirements-mandatory.txt
fi

# Show install/update page, will be replaced with app by install.sh
# Link sources below $OPENSHIFT_REPO_DIR must be relative or they will be invalid after restore/clone operations
mkdir -p $OPENSHIFT_REPO_DIR/wsgi
ln -sf ../openshift/wsgi_install.py $OPENSHIFT_REPO_DIR/wsgi/application
