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 #90 from YunoHost-Apps/patch

Patch
This commit is contained in:
Éric Gaspar 2021-06-26 21:10:35 +02:00 committed by GitHub
commit 90164ffaa7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 23 deletions

View file

@ -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
@ -105,7 +102,7 @@ ynh_script_progression --message="Configuring Searx..." --weight=2
secret_key=$(ynh_string_random)
ynh_add_config --template="../conf/settings.yml" --destination="$final_path/searx/settings.yml"
ynh_add_config --template="../conf/settings.yml" --destination="$final_path/searx/settings.yml" 2>/dev/null
#=================================================
# SET PERMISSIONS ON SEARX DIRECTORY
@ -118,7 +115,7 @@ chown -R $app: $final_path
#=================================================
ynh_script_progression --message="Configuring uWSGI for Searx..." --weight=2
ynh_add_uwsgi_service
ynh_add_uwsgi_service 2>/dev/null
#=================================================
# CHECK SEARX STARTING

View file

@ -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

View file

@ -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