mirror of
https://github.com/YunoHost-Apps/searx_ynh.git
synced 2024-09-03 20:16:30 +02:00
Add progression with ynh_print_info
This commit is contained in:
parent
ccc07840b7
commit
f1bbc57a4e
6 changed files with 72 additions and 1 deletions
|
@ -15,7 +15,7 @@
|
|||
"email": "opi@zeropi.net"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.7.2"
|
||||
"yunohost": ">= 3.2.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
|
|
|
@ -19,6 +19,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -30,12 +31,14 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
#=================================================
|
||||
# BACKUP OF THE MAIN DIR OF THE APP
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the main app directory..."
|
||||
|
||||
ynh_backup "$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP OF THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Backing up nginx web server configuration..."
|
||||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
@ -44,5 +47,12 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# BACKUP OF THE UWSGI CONFIG
|
||||
#=================================================
|
||||
ynh_print_info "Backing up uWSGI configuration..."
|
||||
|
||||
ynh_backup "/etc/uwsgi/apps-available/$app.ini"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -32,6 +32,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||
#=================================================
|
||||
ynh_print_info "Validating installation parameters..."
|
||||
|
||||
final_path="/opt/yunohost/$app"
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
@ -45,6 +46,7 @@ ynh_webpath_register $app $domain $path_url
|
|||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_print_info "Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app path $path_url
|
||||
|
@ -55,12 +57,14 @@ ynh_app_setting_set $app is_public $is_public
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Installing dependencies..."
|
||||
|
||||
ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv python-babel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Configuring nginx web server..."
|
||||
|
||||
path_no_root=${path_url%/}
|
||||
# Create a dedicated nginx config
|
||||
|
@ -69,6 +73,7 @@ ynh_add_nginx_config "path_no_root"
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create $app
|
||||
|
@ -76,6 +81,7 @@ ynh_system_user_create $app
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info "Setting up source files..."
|
||||
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
|
@ -86,6 +92,7 @@ ynh_setup_source "$final_path"
|
|||
#=================================================
|
||||
# INSTALL SEARX IN A VIRTUALENV
|
||||
#=================================================
|
||||
ynh_print_info "Installing Searx..."
|
||||
|
||||
virtualenv --system-site-packages "$final_path"
|
||||
set +u; source $final_path/bin/activate; set -u
|
||||
|
@ -95,6 +102,7 @@ pip install --requirement $final_path/requirements-ynh.txt
|
|||
#=================================================
|
||||
# CONFIGURE SEARX
|
||||
#=================================================
|
||||
ynh_print_info "Configuring Searx..."
|
||||
|
||||
# Change instance name
|
||||
ynh_replace_string "instance_name : \"searx\"" "instance_name : \"YunoSearx\"" "$final_path/searx/settings.yml"
|
||||
|
@ -120,6 +128,7 @@ chown $app: --recursive "$final_path"
|
|||
#=================================================
|
||||
# CONFIGURE UWSGI FOR SEARX
|
||||
#=================================================
|
||||
ynh_print_info "Configuring uWSGI for Searx..."
|
||||
|
||||
cp ../conf/searx.ini /etc/uwsgi/apps-available/$app.ini
|
||||
ynh_replace_string "__APP__" "$app" /etc/uwsgi/apps-available/$app.ini
|
||||
|
@ -136,6 +145,7 @@ yunohost service add uwsgi --log "/var/log/uwsgi/app/$app.log"
|
|||
#=================================================
|
||||
# CHECK SEARX STARTING
|
||||
#=================================================
|
||||
ynh_print_info "Starting Searx..."
|
||||
|
||||
# Wait for searx to be fully started
|
||||
ynh_systemd_action --service_name=uwsgi --action=restart --line_match="spawned uWSGI master process" --log_path="/var/log/uwsgi/app/$app.log"
|
||||
|
@ -145,6 +155,7 @@ ynh_systemd_action --service_name=uwsgi --action=restart --line_match="spawned u
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info "Configuring SSOwat..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
|
@ -155,5 +166,12 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Installation of $app completed"
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -23,6 +24,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_print_info "Stopping and removing the systemd service"
|
||||
|
||||
# Remove the uwsgi configuration
|
||||
ynh_systemd_action --service_name=uwsgi --action=stop
|
||||
|
@ -36,18 +38,21 @@ ynh_secure_remove "/etc/uwsgi/apps-available/$app.ini"
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Removing dependencies"
|
||||
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MAIN DIR OF THE APP
|
||||
#=================================================
|
||||
ynh_print_info "Removing app main directory"
|
||||
|
||||
ynh_secure_remove "$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing nginx web server configuration"
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
@ -73,6 +78,13 @@ fi
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Removing the dedicated system user"
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete $app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Removal of $app completed"
|
||||
|
|
|
@ -32,6 +32,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_print_info "Validating restoration parameters..."
|
||||
|
||||
ynh_webpath_available $domain $path_url \
|
||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||
|
@ -49,6 +50,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# RESTORE OF THE MAIN DIR OF THE APP
|
||||
#=================================================
|
||||
ynh_print_info "Restoring the app main directory..."
|
||||
|
||||
mkdir -p "$(dirname "$final_path")"
|
||||
ynh_restore_file "$final_path"
|
||||
|
@ -56,12 +58,14 @@ ynh_restore_file "$final_path"
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Reinstalling dependencies..."
|
||||
|
||||
ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv python-babel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python
|
||||
|
||||
#=================================================
|
||||
# RECREATE OF THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Recreating the dedicated system user..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
@ -86,12 +90,20 @@ ln -s /etc/uwsgi/apps-available/$app.ini /etc/uwsgi/apps-enabled/$app.ini
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# CHECK SEARX STARTING
|
||||
#=================================================
|
||||
ynh_print_info "Starting Searx..."
|
||||
|
||||
# Wait for searx to be fully started
|
||||
ynh_systemd_action --service_name=uwsgi --action=restart --line_match="spawned uWSGI master process" --log_path="/var/log/uwsgi/app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Restoration completed for $app"
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -23,6 +24,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_print_info "Ensuring downward compatibility..."
|
||||
|
||||
# Fix is_public as a boolean value
|
||||
if [ "${is_public,,}" = "yes" ]; then
|
||||
|
@ -42,6 +44,7 @@ fi
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -64,12 +67,14 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv python-babel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading source files..."
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different "$final_path/searx/settings.yml"
|
||||
|
@ -80,6 +85,7 @@ ynh_setup_source "$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading nginx web server configuration..."
|
||||
|
||||
path_no_root=${path_url%/}
|
||||
# Create a dedicated nginx config
|
||||
|
@ -88,6 +94,7 @@ ynh_add_nginx_config "path_no_root"
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
@ -97,6 +104,7 @@ ynh_system_user_create $app
|
|||
#=================================================
|
||||
# UPGRADE SEARX IN ITS VIRTUALENV
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading Searx..."
|
||||
|
||||
rm -r $final_path/lib/python2.7/site-packages/setuptools $final_path/lib/python2.7/site-packages/setuptools-*
|
||||
virtualenv --system-site-packages "$final_path"
|
||||
|
@ -107,6 +115,7 @@ pip install --requirement $final_path/requirements-ynh.txt --upgrade
|
|||
#=================================================
|
||||
# CONFIGURE SEARX
|
||||
#=================================================
|
||||
ynh_print_info "Reconfiguring Searx..."
|
||||
|
||||
# Change instance name
|
||||
ynh_replace_string "instance_name : \"searx\"" "instance_name : \"YunoSearx\"" "$final_path/searx/settings.yml"
|
||||
|
@ -134,6 +143,7 @@ chown $app: --recursive "$final_path"
|
|||
#=================================================
|
||||
# CONFIGURE UWSGI FOR SEARX
|
||||
#=================================================
|
||||
ynh_print_info "Reconfiguring uWSGI for Searx..."
|
||||
|
||||
cp ../conf/searx.ini /etc/uwsgi/apps-available/$app.ini
|
||||
ynh_replace_string "__APP__" "$app" /etc/uwsgi/apps-available/$app.ini
|
||||
|
@ -142,6 +152,7 @@ ynh_replace_string "__FINALPATH__" "$final_path" /etc/uwsgi/apps-available/$app.
|
|||
#=================================================
|
||||
# CHECK SEARX STARTING
|
||||
#=================================================
|
||||
ynh_print_info "Restarting Searx..."
|
||||
|
||||
# Wait for searx to be fully started
|
||||
ynh_systemd_action --service_name=uwsgi --action=restart --line_match="spawned uWSGI master process" --log_path="/var/log/uwsgi/app/$app.log"
|
||||
|
@ -149,6 +160,7 @@ ynh_systemd_action --service_name=uwsgi --action=restart --line_match="spawned u
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading SSOwat configuration..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
|
@ -159,5 +171,12 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue