mirror of
https://github.com/YunoHost-Apps/searx_ynh.git
synced 2024-09-03 20:16:30 +02:00
Merge pull request #8 from julienmalik/master
fix for install path not consistent along the install script + various other fixes
This commit is contained in:
commit
736eb5499c
2 changed files with 46 additions and 40 deletions
|
@ -18,44 +18,46 @@ 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
|
||||
|
||||
final_path=/opt/yunohost/searx
|
||||
|
||||
# Init virtualenv
|
||||
if [ ! -d /opt/yunohost/searx ];
|
||||
if [ ! -d $final_path ];
|
||||
then
|
||||
sudo mkdir -p /opt/yunohost/searx
|
||||
sudo mkdir -p $final_path
|
||||
fi
|
||||
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"
|
||||
sudo cp -r ../sources/* $final_path
|
||||
sudo virtualenv $final_path
|
||||
sudo bash -c "source $final_path/bin/activate && pip install -r $final_path/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
|
||||
sudo cp ../conf/settings.yml /opt/searx/searx/
|
||||
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/searx/searx/settings.yml
|
||||
sudo cp ../conf/settings.yml $final_path/searx/
|
||||
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" $final_path/searx/settings.yml
|
||||
if [ "$path" != "/" ];
|
||||
then
|
||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path/@g" /opt/searx/searx/settings.yml
|
||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path/@g" $final_path/searx/settings.yml
|
||||
else
|
||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path@g" /opt/searx/searx/settings.yml
|
||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path@g" $final_path/searx/settings.yml
|
||||
fi
|
||||
|
||||
# Set permissions to searx directory
|
||||
sudo useradd searx -d /opt/yunohost/searx
|
||||
sudo chown searx:searx -R /opt/yunohost/searx
|
||||
sudo useradd searx -d $final_path
|
||||
sudo chown searx:searx -R $final_path
|
||||
|
||||
# Copy uwsgi config
|
||||
sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
|
||||
|
@ -71,8 +73,8 @@ else
|
|||
fi
|
||||
|
||||
# Fix permission
|
||||
#sudo find /opt/yunohost/searx/ -type d -exec chmod 2755 {} \;
|
||||
#sudo find /opt/yunohost/searx/ -type f -exec chmod g+r,o+r {} \;
|
||||
#sudo find $final_path/ -type d -exec chmod 2755 {} \;
|
||||
#sudo find $final_path/ -type f -exec chmod g+r,o+r {} \;
|
||||
|
||||
## Reload Nginx and regenerate SSOwat conf
|
||||
sudo service nginx reload
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(sudo yunohost app setting searx domain)
|
||||
path=$(sudo yunohost app setting searx path)
|
||||
|
@ -10,29 +12,31 @@ 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=256
|
||||
sudo chmod 600 $tmp_swap_file
|
||||
sudo mkswap $tmp_swap_file
|
||||
sudo swapon $tmp_swap_file
|
||||
fi
|
||||
|
||||
final_path=/opt/yunohost/searx
|
||||
|
||||
# Init virtualenv
|
||||
if [ ! -d /opt/searx ];
|
||||
if [ ! -d $final_path ];
|
||||
then
|
||||
sudo mkdir /opt/searx
|
||||
sudo mkdir $final_path
|
||||
fi
|
||||
sudo cp -r ../sources/* /opt/searx
|
||||
sudo virtualenv /opt/searx
|
||||
sudo bash -c "source /opt/searx/bin/activate && pip install -r /opt/searx/requirements.txt"
|
||||
sudo cp -r ../sources/* $final_path
|
||||
sudo virtualenv $final_path
|
||||
sudo bash -c "source $final_path/bin/activate && pip install -r $final_path/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
|
||||
|
@ -42,18 +46,18 @@ then
|
|||
fi
|
||||
|
||||
#Configuration Searx
|
||||
sudo cp ../conf/settings.yml /opt/searx/searx/
|
||||
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/searx/searx/settings.yml
|
||||
sudo cp ../conf/settings.yml $final_path/searx/
|
||||
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" $final_path/searx/settings.yml
|
||||
if [ "$path" != "/" ];
|
||||
then
|
||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path/@g" /opt/searx/searx/settings.yml
|
||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path/@g" $final_path/searx/settings.yml
|
||||
else
|
||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path@g" /opt/searx/searx/settings.yml
|
||||
sudo sed -i -e "s@ynhbaseurl@https://$domain$path@g" $final_path/searx/settings.yml
|
||||
fi
|
||||
|
||||
# Set permissions to searx directory
|
||||
sudo useradd searx -d /opt/searx
|
||||
sudo chown searx:searx -R /opt/searx
|
||||
sudo useradd searx -d $final_path
|
||||
sudo chown searx:searx -R $final_path
|
||||
|
||||
# Copy uwsgi config
|
||||
sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
|
||||
|
@ -69,8 +73,8 @@ else
|
|||
fi
|
||||
|
||||
# Fix permission
|
||||
#sudo find /opt/searx/ -type d -exec chmod 2755 {} \;
|
||||
#sudo find /opt/searx/ -type f -exec chmod g+r,o+r {} \;
|
||||
#sudo find $final_path/ -type d -exec chmod 2755 {} \;
|
||||
#sudo find $final_path/ -type f -exec chmod g+r,o+r {} \;
|
||||
|
||||
## Reload Nginx and regenerate SSOwat conf
|
||||
sudo service nginx reload
|
||||
|
|
Loading…
Reference in a new issue