mirror of
https://github.com/YunoHost-Apps/searx_ynh.git
synced 2024-09-03 20:16:30 +02:00
Merge pull request #72 from YunoHost-Apps/v0.18
upgrade to version 0.18
This commit is contained in:
commit
902b167d04
11 changed files with 26 additions and 130 deletions
|
@ -1,7 +1,7 @@
|
|||
# Searx for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/searx.svg)](https://dash.yunohost.org/appci/app/searx) ![](https://ci-apps.yunohost.org/ci/badges/searx.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/searx.maintain.svg)
|
||||
[![Install Searx with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=searx)
|
||||
[![Install Searx with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=searx)
|
||||
|
||||
> *This package allow you to install Searx quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||
|
@ -10,7 +10,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
|
|||
|
||||
Searx is a privacy-respecting, hackable metasearch engine.
|
||||
|
||||
**Shipped version:** 0.17.0
|
||||
**Shipped version:** 0.18.0
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
|
|
@ -14,11 +14,8 @@
|
|||
upgrade=1 from_commit=0bc4b329402773653e4a70adf6a397c5cefea947
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
incorrect_path=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Levels
|
||||
Level 5=auto
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/searx/searx/archive/v0.17.0.tar.gz
|
||||
SOURCE_SUM=1e5a6427403711fb103332c6faeb99cb1df64a5349530c360d23615ec24ae6b0
|
||||
SOURCE_URL=https://github.com/searx/searx/archive/v0.18.0.tar.gz
|
||||
SOURCE_SUM=d22430ad92262d9114ad169e001975fe5195afdcc679d6f6bf030e0c1a5b79f0
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"fr": "Méta-moteur de recherche respectueux de la vie privée et bidouillable",
|
||||
"de": "Meta-Suchmaschine, die den Privatsphäre wahrt und 'hackable' ist."
|
||||
},
|
||||
"version": "0.17.0~ynh1",
|
||||
"version": "0.18.0~ynh1",
|
||||
"url": "https://searx.github.io/searx/",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
|
|
|
@ -111,7 +111,7 @@ ynh_add_uwsgi_service () {
|
|||
cp ../conf/uwsgi-app@override.service /etc/systemd/system/uwsgi-app@$app.service.d/override.conf
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable "uwsgi-app@$app.service"
|
||||
systemctl enable "uwsgi-app@$app.service" --quiet
|
||||
|
||||
# Add as a service
|
||||
yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/$app/$app.log"
|
||||
|
@ -124,7 +124,7 @@ ynh_remove_uwsgi_service () {
|
|||
local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||
if [ -e "$finaluwsgiini" ]; then
|
||||
yunohost service remove "uwsgi-app@$app"
|
||||
systemctl disable "uwsgi-app@$app.service"
|
||||
systemctl disable "uwsgi-app@$app.service" --quiet
|
||||
|
||||
ynh_secure_remove --file="$finaluwsgiini"
|
||||
ynh_secure_remove --file="/var/log/uwsgi/$app"
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Remove a file or a directory securely
|
||||
#
|
||||
# usage: ynh_secure_remove --file=path_to_remove [--regex=regex to append to $file] [--non_recursive] [--dry_run]
|
||||
# | arg: -f, --file - File or directory to remove
|
||||
# | arg: -r, --regex - Regex to append to $file to filter the files to remove
|
||||
# | arg: -n, --non_recursive - Perform a non recursive rm and a non recursive search with the regex
|
||||
# | arg: -d, --dry_run - Do not remove, only list the files to remove
|
||||
#
|
||||
# Requires YunoHost version 2.6.4 or higher.
|
||||
ynh_secure_remove () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=frnd
|
||||
declare -Ar args_array=( [f]=file= [r]=regex= [n]=non_recursive [d]=dry_run )
|
||||
local file
|
||||
local regex
|
||||
local dry_run
|
||||
local non_recursive
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
regex=${regex:-}
|
||||
dry_run=${dry_run:-0}
|
||||
non_recursive=${non_recursive:-0}
|
||||
|
||||
local forbidden_path="
|
||||
/var/www \
|
||||
/home/yunohost.app"
|
||||
|
||||
# Fail if no argument is provided to the helper.
|
||||
if [ -z "$file" ]
|
||||
then
|
||||
ynh_print_warn --message="ynh_secure_remove called with no argument --file, ignoring."
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -n "$regex" ]
|
||||
then
|
||||
if [ -e "$file" ]
|
||||
then
|
||||
if [ $non_recursive -eq 1 ]; then
|
||||
local recursive="-maxdepth 1"
|
||||
else
|
||||
local recursive=""
|
||||
fi
|
||||
# Use find to list the files in $file and grep to filter with the regex
|
||||
files_to_remove="$(find -P "$file" $recursive -name ".." -prune -o -print | grep --extended-regexp "$regex")"
|
||||
else
|
||||
ynh_print_info --message="'$file' wasn't deleted because it doesn't exist."
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
files_to_remove="$file"
|
||||
fi
|
||||
|
||||
# Check each file before removing it
|
||||
while read file_to_remove
|
||||
do
|
||||
if [ -n "$file_to_remove" ]
|
||||
then
|
||||
# Check all forbidden path before removing anything
|
||||
# First match all paths or subpaths in $forbidden_path
|
||||
if [[ "$forbidden_path" =~ "$file_to_remove" ]] || \
|
||||
# Match all first level paths from / (Like /var, /root, etc...)
|
||||
[[ "$file_to_remove" =~ ^/[[:alnum:]]+$ ]] || \
|
||||
# Match if the path finishes by /. Because it seems there is an empty variable
|
||||
[ "${file_to_remove:${#file_to_remove}-1}" = "/" ]
|
||||
then
|
||||
ynh_print_err --message="Not deleting '$file_to_remove' because this path is forbidden !!!"
|
||||
|
||||
# If the file to remove exists
|
||||
elif [ -e "$file_to_remove" ]
|
||||
then
|
||||
if [ $dry_run -eq 1 ]
|
||||
then
|
||||
ynh_print_warn --message="File to remove: $file_to_remove"
|
||||
else
|
||||
if [ $non_recursive -eq 1 ]; then
|
||||
local recursive=""
|
||||
else
|
||||
local recursive="--recursive"
|
||||
fi
|
||||
|
||||
# Remove a file or a directory
|
||||
rm --force $recursive "$file_to_remove"
|
||||
fi
|
||||
else
|
||||
# Ignore non existent files with regex, as we likely remove the parent directory before its content is listed.
|
||||
if [ -z "$regex" ]
|
||||
then
|
||||
ynh_print_info --message="'$file_to_remove' wasn't deleted because it doesn't exist."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done <<< "$(echo "$files_to_remove")"
|
||||
}
|
|
@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
@ -90,7 +90,7 @@ fi
|
|||
#=================================================
|
||||
# RECONFIGURING SEARX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring Searx..."
|
||||
ynh_script_progression --message="Reconfiguring Searx..." --weight=2
|
||||
|
||||
ynh_replace_string --match_string="base_url : https://${old_domain}${old_path%/}/" --replace_string="base_url : https://${new_domain}${new_path%/}/" --target_file="$final_path/searx/settings.yml"
|
||||
|
||||
|
@ -106,7 +106,7 @@ ynh_systemd_action --service_name=uwsgi-app@$app.service --action=restart --line
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
final_path="/opt/yunohost/$app"
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
@ -61,7 +61,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||
|
||||
path_no_root=${path_url%/}
|
||||
# Create a dedicated NGINX config
|
||||
|
@ -89,7 +89,7 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
#=================================================
|
||||
# INSTALL SEARX IN A VIRTUALENV
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Searx..."
|
||||
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
|
||||
|
@ -121,7 +121,7 @@ chown -R $app: "$final_path"
|
|||
#=================================================
|
||||
# CONFIGURE UWSGI FOR SEARX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring uWSGI for Searx..."
|
||||
ynh_script_progression --message="Configuring uWSGI for Searx..." --weight=2
|
||||
|
||||
ynh_add_uwsgi_service
|
||||
|
||||
|
@ -145,7 +145,7 @@ ynh_systemd_action --service_name=uwsgi-app@$app.service --action=start --line_m
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..."
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=2
|
||||
|
||||
# Make app public if necessary or protect it
|
||||
if [ $is_public -eq 1 ]
|
||||
|
@ -156,7 +156,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2
|
||||
|
||||
# Remove the uwsgi configuration
|
||||
ynh_systemd_action --service_name "uwsgi-app@$app.service" --action stop
|
||||
|
@ -40,7 +40,7 @@ ynh_remove_app_dependencies
|
|||
#=================================================
|
||||
# REMOVE THE MAIN DIR OF THE APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=2
|
||||
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
|
@ -73,7 +73,7 @@ fi
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
|
|
@ -50,7 +50,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# RESTORE OF THE MAIN DIR OF THE APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=2
|
||||
|
||||
mkdir -p "$(dirname "$final_path")"
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
@ -86,7 +86,7 @@ ynh_restore_file --origin_path="/etc/uwsgi/apps-available/$app.ini"
|
|||
ynh_restore_file --origin_path "/var/log/uwsgi/$app"
|
||||
chown $app:root /var/log/uwsgi/$app
|
||||
ynh_check_global_uwsgi_config
|
||||
systemctl enable "uwsgi-app@$app.service"
|
||||
systemctl enable "uwsgi-app@$app.service" --quiet
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
|
@ -100,7 +100,7 @@ yunohost service add uwsgi --log "/var/log/uwsgi/app/$app.log"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
source _ynh_secure_remove.sh
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
|
@ -89,7 +88,7 @@ fi
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||
|
||||
path_no_root=${path_url%/}
|
||||
# Create a dedicated NGINX config
|
||||
|
@ -98,7 +97,7 @@ ynh_add_nginx_config "path_no_root"
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
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
|
||||
|
@ -153,7 +152,7 @@ chown -R $app: "$final_path"
|
|||
#=================================================
|
||||
# CONFIGURE UWSGI FOR SEARX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring uWSGI for Searx..."
|
||||
ynh_script_progression --message="Reconfiguring uWSGI for Searx..." --weight=2
|
||||
|
||||
# Clean old files
|
||||
ynh_secure_remove --file="/etc/uwsgi/apps-enabled/$app.ini"
|
||||
|
@ -178,7 +177,7 @@ ynh_systemd_action --service_name=uwsgi-app@$app.service --action=restart --line
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
Loading…
Reference in a new issue