mirror of
https://github.com/YunoHost-Apps/searxng_ynh.git
synced 2024-09-03 20:26:00 +02:00
Refractor
This commit is contained in:
parent
ef1069e451
commit
186cb28e9e
1 changed files with 26 additions and 12 deletions
|
@ -28,7 +28,7 @@ myynh_install_searxng () {
|
||||||
# Create the virtual environment
|
# Create the virtual environment
|
||||||
sudo -H -u $app -i bash << EOF
|
sudo -H -u $app -i bash << EOF
|
||||||
python3 -m venv "$install_dir/searxng-pyenv"
|
python3 -m venv "$install_dir/searxng-pyenv"
|
||||||
echo ". $install_dir/searxng-pyenv/bin/activate" >> "$install_dir/.profile"
|
echo ". $install_dir/searxng-pyenv/bin/activate" > "$install_dir/.profile"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Check if virtualenv was sourced from the login
|
# Check if virtualenv was sourced from the login
|
||||||
|
@ -50,20 +50,32 @@ EOF
|
||||||
myynh_upgrade_venv_directory () {
|
myynh_upgrade_venv_directory () {
|
||||||
|
|
||||||
# Remove old python links before recreating them
|
# Remove old python links before recreating them
|
||||||
find "$install_dir/searxng-pyenv/bin/" -type l -name 'python*' \
|
if [ -d "$install_dir/searxng-pyenv/bin/" ]
|
||||||
|
then
|
||||||
|
find "$install_dir/searxng-pyenv/bin/" \
|
||||||
|
-type l -name 'python*' \
|
||||||
-exec bash -c 'rm --force "$1"' _ {} \;
|
-exec bash -c 'rm --force "$1"' _ {} \;
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove old python directories before recreating them
|
# Remove old python directories before recreating them
|
||||||
find "$install_dir/searxng-pyenv/lib/" -mindepth 1 -maxdepth 1 -type d -name "python*" \
|
if [ -d "$install_dir/searxng-pyenv/lib/" ]
|
||||||
|
then
|
||||||
|
find "$install_dir/searxng-pyenv/lib/" \
|
||||||
|
-mindepth 1 -maxdepth 1 -type d -name "python*" \
|
||||||
-not -path "*/python*" \
|
-not -path "*/python*" \
|
||||||
-exec bash -c 'rm --force --recursive "$1"' _ {} \;
|
-exec bash -c 'rm --force --recursive "$1"' _ {} \;
|
||||||
find "$install_dir/searxng-pyenv/include/site/" -mindepth 1 -maxdepth 1 -type d -name "python*" \
|
fi
|
||||||
|
if [ -d "$install_dir/searxng-pyenv/include/site/" ]
|
||||||
|
then
|
||||||
|
find "$install_dir/searxng-pyenv/include/site/" \
|
||||||
|
-mindepth 1 -maxdepth 1 -type d -name "python*" \
|
||||||
-not -path "*/python*" \
|
-not -path "*/python*" \
|
||||||
-exec bash -c 'rm --force --recursive "$1"' _ {} \;
|
-exec bash -c 'rm --force --recursive "$1"' _ {} \;
|
||||||
|
fi
|
||||||
|
|
||||||
# Upgrade the virtual environment directory
|
# Upgrade the virtual environment directory
|
||||||
sudo -H -u $app -i bash << EOF
|
sudo -H -u $app -i bash << EOF
|
||||||
python3 -m venv --upgrade "$install_dir"
|
python3 -m venv --upgrade "$install_dir/searxng-pyenv"
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +153,8 @@ ynh_add_uwsgi_service () {
|
||||||
|
|
||||||
# Setup specific Systemd rules if necessary
|
# Setup specific Systemd rules if necessary
|
||||||
mkdir -p "/etc/systemd/system/uwsgi-app@$app.service.d"
|
mkdir -p "/etc/systemd/system/uwsgi-app@$app.service.d"
|
||||||
if [ -e "../conf/uwsgi-app@override.service" ]; then
|
if [ -e "../conf/uwsgi-app@override.service" ]
|
||||||
|
then
|
||||||
ynh_add_config --template="uwsgi-app@override.service" --destination="/etc/systemd/system/uwsgi-app@$app.service.d/override.conf"
|
ynh_add_config --template="uwsgi-app@override.service" --destination="/etc/systemd/system/uwsgi-app@$app.service.d/override.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -157,7 +170,8 @@ ynh_add_uwsgi_service () {
|
||||||
# usage: ynh_remove_uwsgi_service
|
# usage: ynh_remove_uwsgi_service
|
||||||
ynh_remove_uwsgi_service () {
|
ynh_remove_uwsgi_service () {
|
||||||
local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||||
if [ -e "$finaluwsgiini" ]; then
|
if [ -e "$finaluwsgiini" ]
|
||||||
|
then
|
||||||
yunohost service remove "uwsgi-app@$app"
|
yunohost service remove "uwsgi-app@$app"
|
||||||
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop"
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop"
|
||||||
ynh_exec_fully_quiet ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="disable"
|
ynh_exec_fully_quiet ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="disable"
|
||||||
|
|
Loading…
Reference in a new issue