[enh] use variable for swapfile consistency
This commit is contained in:
parent
8658db8ff6
commit
a739fc0bb2
|
@ -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
|
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev uwsgi uwsgi-plugin-python -y
|
||||||
|
|
||||||
# Check Swap
|
# Check Swap
|
||||||
|
tmp_swap_file=/tmp/searx_swapfile
|
||||||
if [ $(sudo swapon -s | wc -l) = 1 ];
|
if [ $(sudo swapon -s | wc -l) = 1 ];
|
||||||
then
|
then
|
||||||
sudo dd if=/dev/zero of=/tmp/myswapfile bs=1M count=256
|
sudo dd if=/dev/zero of=$tmp_swap_file bs=1M count=256
|
||||||
sudo chmod 600 /tmp/myswapfile
|
sudo chmod 600 $tmp_swap_file
|
||||||
sudo mkswap /tmp/myswapfile
|
sudo mkswap $tmp_swap_file
|
||||||
sudo swapon /tmp/myswapfile
|
sudo swapon $tmp_swap_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Init virtualenv
|
# Init virtualenv
|
||||||
if [ ! -d /opt/yunohost/searx ];
|
if [ ! -d /opt/yunohost/searx ];
|
||||||
then
|
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"
|
sudo bash -c "source /opt/yunohost/searx/bin/activate && pip install -r /opt/yunohost/searx/requirements.txt"
|
||||||
|
|
||||||
# Disable swapfile
|
# Disable swapfile
|
||||||
if [ -f /tmp/myswapfile ];
|
if [ -f $tmp_swap_file ];
|
||||||
then
|
then
|
||||||
sudo swapoff /tmp/myswapfile
|
sudo swapoff $tmp_swap_file
|
||||||
sudo rm -f /tmp/myswapfile
|
sudo rm -f $tmp_swap_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Configuration Searx
|
#Configuration Searx
|
||||||
|
|
|
@ -10,12 +10,13 @@ path=${path%/}
|
||||||
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev -y
|
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev -y
|
||||||
|
|
||||||
# Check Swap
|
# Check Swap
|
||||||
|
tmp_swap_file=/tmp/searx_swapfile
|
||||||
if [ $(sudo swapon -s | wc -l) = 1 ];
|
if [ $(sudo swapon -s | wc -l) = 1 ];
|
||||||
then
|
then
|
||||||
sudo dd if=/dev/zero of=/tmp/myswapfile bs=1M count=1024
|
sudo dd if=/dev/zero of=$tmp_swap_file bs=1M count=1024
|
||||||
sudo chmod 600 /tmp/myswapfile
|
sudo chmod 600 $tmp_swap_file
|
||||||
sudo mkswap /tmp/myswapfile
|
sudo mkswap $tmp_swap_file
|
||||||
sudo swapon /tmp/myswapfile
|
sudo swapon $tmp_swap_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,10 +30,10 @@ sudo virtualenv /opt/searx
|
||||||
sudo bash -c "source /opt/searx/bin/activate && pip install -r /opt/searx/requirements.txt"
|
sudo bash -c "source /opt/searx/bin/activate && pip install -r /opt/searx/requirements.txt"
|
||||||
|
|
||||||
# Disable swapfile
|
# Disable swapfile
|
||||||
if [ -f /tmp/myswapfile ];
|
if [ -f $tmp_swap_file ];
|
||||||
then
|
then
|
||||||
sudo swapoff /tmp/myswapfile
|
sudo swapoff $tmp_swap_file
|
||||||
sudo rm -f /tmp/myswapfile
|
sudo rm -f $tmp_swap_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove trailing "/" for next commands if installing on a subpath
|
# Remove trailing "/" for next commands if installing on a subpath
|
||||||
|
|
Loading…
Reference in New Issue