From 3e77a1aa8f9c87fd41e1860ca64f245fe84c0d2c Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 22 Jul 2024 09:49:19 +0200 Subject: [PATCH] Refrcator --- scripts/_common.sh | 38 +------------------------------------- scripts/upgrade | 3 ++- 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index d18965d..e91855d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -16,10 +16,7 @@ myynh_source_searxng () { # Download source sudo -H -u $app -i bash << EOF -if [ ! -d "$install_dir/searxng-src" ] -then - mkdir "$install_dir/searxng-src" -fi +mkdir "$install_dir/searxng-src" git clone -n "$repo_fullpath" "$install_dir/searxng-src" 2>&1 EOF @@ -54,39 +51,6 @@ pip install -e . EOF } -# Upgrade the virtual environment directory -myynh_upgrade_venv_directory () { - - # Remove old python links before recreating them - if [ -d "$install_dir/searxng-pyenv/bin/" ] - then - find "$install_dir/searxng-pyenv/bin/" \ - -type l -name 'python*' \ - -exec bash -c 'rm --force "$1"' _ {} \; - fi - - # Remove old python directories before recreating them - 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*" \ - -exec bash -c 'rm --force --recursive "$1"' _ {} \; - 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*" \ - -exec bash -c 'rm --force --recursive "$1"' _ {} \; - fi - - # Upgrade the virtual environment directory - sudo -H -u $app -i bash << EOF -python3 -m venv --upgrade "$install_dir/searxng-pyenv" -EOF -} - # Set permissions myynh_set_permissions () { chown -R $app: "$install_dir" diff --git a/scripts/upgrade b/scripts/upgrade index 33bb372..8dfd03b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,7 +46,8 @@ ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="stop" --log if [ "$upgrade_type" == "UPGRADE_APP" ] then - myynh_upgrade_venv_directory + ynh_secure_remove --file="$install_dir/searxng-src" + ynh_secure_remove --file="$install_dir/searxng-pyenv" myynh_source_searxng myynh_install_searxng fi