diff --git a/scripts/install b/scripts/install index 192bda6..cddc602 100644 --- a/scripts/install +++ b/scripts/install @@ -18,15 +18,15 @@ sudo yunohost app setting searx is_public -v $is_public sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev uwsgi uwsgi-plugin-python -y # Check Swap +tmp_swap_file=/tmp/searx_swapfile if [ $(sudo swapon -s | wc -l) = 1 ]; then - sudo dd if=/dev/zero of=/tmp/myswapfile bs=1M count=256 - sudo chmod 600 /tmp/myswapfile - sudo mkswap /tmp/myswapfile - sudo swapon /tmp/myswapfile + 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 - # Init virtualenv if [ ! -d /opt/yunohost/searx ]; then @@ -37,10 +37,10 @@ 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 ]; +if [ -f $tmp_swap_file ]; then - sudo swapoff /tmp/myswapfile - sudo rm -f /tmp/myswapfile + sudo swapoff $tmp_swap_file + sudo rm -f $tmp_swap_file fi #Configuration Searx diff --git a/scripts/upgrade b/scripts/upgrade index ed28ff9..606475b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,12 +10,13 @@ path=${path%/} 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/myswapfile bs=1M count=1024 - sudo chmod 600 /tmp/myswapfile - sudo mkswap /tmp/myswapfile - sudo swapon /tmp/myswapfile + sudo dd if=/dev/zero of=$tmp_swap_file bs=1M count=1024 + sudo chmod 600 $tmp_swap_file + sudo mkswap $tmp_swap_file + sudo swapon $tmp_swap_file fi @@ -29,10 +30,10 @@ sudo virtualenv /opt/searx sudo bash -c "source /opt/searx/bin/activate && pip install -r /opt/searx/requirements.txt" # Disable swapfile -if [ -f /tmp/myswapfile ]; +if [ -f $tmp_swap_file ]; then - sudo swapoff /tmp/myswapfile - sudo rm -f /tmp/myswapfile + sudo swapoff $tmp_swap_file + sudo rm -f $tmp_swap_file fi # Remove trailing "/" for next commands if installing on a subpath