From 581e2017b417436d1d8be49115b5abf691d6ad23 Mon Sep 17 00:00:00 2001 From: abeudin Date: Thu, 29 May 2014 14:20:44 +0200 Subject: [PATCH] Update upgrade --- scripts/upgrade | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 9549643..a9d5bf7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,3 +1,46 @@ #!/bin/bash -#TODO +# Retrieve arguments +domain=$(sudo yunohost app setting wordpress domain) +path=$(sudo yunohost app setting wordpress path) + + +# Check depends installation +sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev uwsgi uwsgi-plugin-python -y + +# Check Swap +if [ $(sudo swapon -s | wc -l) = 1 ]; +then +sudo dd if=/dev/zero of=/tmp/myswapfile bs=1M count=128 +sudo chmod 600 /tmp/myswapfile +sudo mkswap /tmp/myswapfile +sudo swapon /tmp/myswapfile +fi + +# Move searx +if [ -d /opt/searx ]; +then + sudo mkdir -p /opt/yunohost/searx + sudo mv /opt/searx /opt/yunohost/ + sudo usermod -d /opt/yunohost/searx + sudo chown searx:searx -R /opt/yunohost/searx +fi + +# Copy uwsgi config +sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/ + +# Init virtualenv +sudo cp -r ../sources/* /opt/yunohost/searx/ +sudo virtualenv /opt/yunohost/searx +sudo bash -c "source /opt/yunohost/searx/bin/activate && pip install -r /opt/yunohost/searx/requirements.txt" + +# Disable swapfile +if [ -f /tmp/myswapfile ]; +then + sudo swapoff /tmp/myswapfile + sudo rm -f /tmp/myswapfile +fi + +## Reload Nginx and regenerate SSOwat conf +sudo service nginx reload +sudo service uwsgi restart