1
0
Fork 0
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:
abeudin 2014-09-29 16:10:06 +02:00
commit 736eb5499c
2 changed files with 46 additions and 40 deletions

View file

@ -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 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
final_path=/opt/yunohost/searx
# Init virtualenv # Init virtualenv
if [ ! -d /opt/yunohost/searx ]; if [ ! -d $final_path ];
then then
sudo mkdir -p /opt/yunohost/searx sudo mkdir -p $final_path
fi fi
sudo cp -r ../sources/* /opt/yunohost/searx sudo cp -r ../sources/* $final_path
sudo virtualenv /opt/yunohost/searx sudo virtualenv $final_path
sudo bash -c "source /opt/yunohost/searx/bin/activate && pip install -r /opt/yunohost/searx/requirements.txt" sudo bash -c "source $final_path/bin/activate && pip install -r $final_path/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
sudo cp ../conf/settings.yml /opt/searx/searx/ sudo cp ../conf/settings.yml $final_path/searx/
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/searx/searx/settings.yml sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" $final_path/searx/settings.yml
if [ "$path" != "/" ]; if [ "$path" != "/" ];
then 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 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 fi
# Set permissions to searx directory # Set permissions to searx directory
sudo useradd searx -d /opt/yunohost/searx sudo useradd searx -d $final_path
sudo chown searx:searx -R /opt/yunohost/searx sudo chown searx:searx -R $final_path
# Copy uwsgi config # Copy uwsgi config
sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/ sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
@ -71,8 +73,8 @@ else
fi fi
# Fix permission # Fix permission
#sudo find /opt/yunohost/searx/ -type d -exec chmod 2755 {} \; #sudo find $final_path/ -type d -exec chmod 2755 {} \;
#sudo find /opt/yunohost/searx/ -type f -exec chmod g+r,o+r {} \; #sudo find $final_path/ -type f -exec chmod g+r,o+r {} \;
## Reload Nginx and regenerate SSOwat conf ## Reload Nginx and regenerate SSOwat conf
sudo service nginx reload sudo service nginx reload

View file

@ -1,3 +1,5 @@
#!/bin/bash
# Retrieve arguments # Retrieve arguments
domain=$(sudo yunohost app setting searx domain) domain=$(sudo yunohost app setting searx domain)
path=$(sudo yunohost app setting searx path) 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 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=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
final_path=/opt/yunohost/searx
# Init virtualenv # Init virtualenv
if [ ! -d /opt/searx ]; if [ ! -d $final_path ];
then then
sudo mkdir /opt/searx sudo mkdir $final_path
fi fi
sudo cp -r ../sources/* /opt/searx sudo cp -r ../sources/* $final_path
sudo virtualenv /opt/searx sudo virtualenv $final_path
sudo bash -c "source /opt/searx/bin/activate && pip install -r /opt/searx/requirements.txt" sudo bash -c "source $final_path/bin/activate && pip install -r $final_path/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
@ -42,18 +46,18 @@ then
fi fi
#Configuration Searx #Configuration Searx
sudo cp ../conf/settings.yml /opt/searx/searx/ sudo cp ../conf/settings.yml $final_path/searx/
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/searx/searx/settings.yml sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" $final_path/searx/settings.yml
if [ "$path" != "/" ]; if [ "$path" != "/" ];
then 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 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 fi
# Set permissions to searx directory # Set permissions to searx directory
sudo useradd searx -d /opt/searx sudo useradd searx -d $final_path
sudo chown searx:searx -R /opt/searx sudo chown searx:searx -R $final_path
# Copy uwsgi config # Copy uwsgi config
sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/ sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
@ -69,8 +73,8 @@ else
fi fi
# Fix permission # Fix permission
#sudo find /opt/searx/ -type d -exec chmod 2755 {} \; #sudo find $final_path/ -type d -exec chmod 2755 {} \;
#sudo find /opt/searx/ -type f -exec chmod g+r,o+r {} \; #sudo find $final_path/ -type f -exec chmod g+r,o+r {} \;
## Reload Nginx and regenerate SSOwat conf ## Reload Nginx and regenerate SSOwat conf
sudo service nginx reload sudo service nginx reload