[enh] use bash var for final path to avoid mess in the future
This commit is contained in:
parent
344c46e59a
commit
add6eebd5f
|
@ -27,14 +27,16 @@ then
|
||||||
sudo swapon $tmp_swap_file
|
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_swap_file ];
|
if [ -f $tmp_swap_file ];
|
||||||
|
@ -44,18 +46,18 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Configuration Searx
|
#Configuration Searx
|
||||||
sudo cp ../conf/settings.yml /opt/yunohost/searx/searx/
|
sudo cp ../conf/settings.yml $final_path/searx/
|
||||||
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/yunohost/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/yunohost/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/yunohost/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
|
||||||
|
|
|
@ -21,14 +21,16 @@ then
|
||||||
sudo swapon $tmp_swap_file
|
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 /opt/yunohost/searx
|
sudo mkdir $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_swap_file ];
|
if [ -f $tmp_swap_file ];
|
||||||
|
@ -44,18 +46,18 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Configuration Searx
|
#Configuration Searx
|
||||||
sudo cp ../conf/settings.yml /opt/yunohost/searx/searx/
|
sudo cp ../conf/settings.yml $final_path/searx/
|
||||||
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/yunohost/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/yunohost/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/yunohost/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
|
||||||
|
|
Loading…
Reference in New Issue