diff --git a/scripts/install b/scripts/install index 039d0cc..2c6f59c 100644 --- a/scripts/install +++ b/scripts/install @@ -63,7 +63,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # NGINX CONFIGURATION @@ -92,11 +92,8 @@ ynh_script_progression --message="Installing Searx..." --weight=2 python3 -m venv --system-site-packages "$final_path" set +u; source $final_path/bin/activate; set -u -pip3 install -U pip -pip3 install -U setuptools -pip3 install -U wheel -pip3 install -U pyyaml -pip3 install --requirement $final_path/requirements-ynh.txt +pip3 install -U pip setuptools wheel pyyaml --no-cache-dir +pip3 install --requirement $final_path/requirements-ynh.txt --no-cache-dir #================================================= # CONFIGURE SEARX diff --git a/scripts/restore b/scripts/restore index 8672a9b..7082849 100755 --- a/scripts/restore +++ b/scripts/restore @@ -53,7 +53,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE OF THE MAIN DIR OF THE APP diff --git a/scripts/upgrade b/scripts/upgrade index afcc96e..9155b83 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,7 +73,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -81,13 +81,23 @@ ynh_system_user_create --username=$app if [ "$upgrade_type" == "UPGRADE_APP" ] then - # Verify the checksum and backup the file if it's different - ynh_backup_if_checksum_is_different --file="$final_path/searx/settings.yml" - ynh_script_progression --message="Upgrading source files..." --weight=3 +# Create a temporary directory + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -a "$final_path/searx/settings.yml" "$tmpdir/settings.yml" + # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" + + # Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/settings.yml" "$final_path/searx/settings.yml" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" + fi #================================================= @@ -125,18 +135,11 @@ pip3 install --requirement $final_path/requirements-ynh.txt --upgrade #================================================= # CONFIGURE SEARX #================================================= -ynh_script_progression --message="Reconfiguring Searx..." --weight=2 +# ynh_script_progression --message="Configuring Searx..." --weight=2 -# Change instance name -ynh_replace_string --match_string="instance_name : \"searx\"" --replace_string="instance_name : \"YunoSearx\"" --target_file="$final_path/searx/settings.yml" +# secret_key=$(ynh_string_random) -# Generate a secret key -ynh_replace_string --match_string="secret_key : \"ultrasecretkey\"" --replace_string="secret_key : \"$(ynh_string_random)\"" --target_file="$final_path/searx/settings.yml" - -# Modify the base_url parameter -#ynh_replace_string --match_string="base_url : False" --replace_string="base_url : https://${domain}${path_url%/}/" --target_file="$final_path/searx/settings.yml" - -ynh_store_file_checksum --file="$final_path/searx/settings.yml" +# ynh_add_config --template="../conf/settings.yml" --destination="$final_path/searx/settings.yml" #================================================= # GENERIC FINALISATION