From d113469115fe435152d7ed00f1673671269f3761 Mon Sep 17 00:00:00 2001 From: abeudin Date: Tue, 3 Mar 2015 13:20:04 +0100 Subject: [PATCH] Update upgrade --- scripts/upgrade | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a1d898c..3a1b996 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,14 +11,21 @@ path=${path%/} # Check depends installation sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev -y + # Check Swap -tmp_swap_file=/tmp/searx_swapfile if [ $(sudo swapon -s | wc -l) = 1 ]; then - sudo dd if=/dev/zero of=$tmp_swap_file bs=1M count=256 - sudo chmod 600 $tmp_swap_file - sudo mkswap $tmp_swap_file - sudo swapon $tmp_swap_file + mount | grep /tmp | grep tmpfs > /dev/null 2>&1 + if [ $? = 1 ]; + then + tmp_swap_file=/tmp/searx_swapfile + else + tmp_swap_file=/var/cache/ + fi + sudo dd if=/dev/zero of=$tmp_swap_file bs=1M count=256 + sudo chmod 600 $tmp_swap_file + sudo mkswap $tmp_swap_file + sudo swapon $tmp_swap_file fi final_path=/opt/yunohost/searx