2022-11-23 10:08:54 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2023-09-18 18:10:55 +02:00
|
|
|
ynh_exec_fully_quiet git clone -n "$repo_fullpath" "$install_dir/searxng-src"
|
|
|
|
pushd "$install_dir/searxng-src"
|
|
|
|
ynh_exec_fully_quiet git checkout "$commit_sha"
|
|
|
|
popd
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2023-09-18 18:10:55 +02:00
|
|
|
ynh_script_progression --message="Installing SearXNG..." --weight=2
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2023-09-18 18:10:55 +02:00
|
|
|
python3 -m venv --system-site-packages "$install_dir/searxng-pyenv"
|
2023-09-18 19:51:03 +02:00
|
|
|
set +o nounset; source "$install_dir/searxng-pyenv/bin/activate"; set -o nounset
|
2023-09-18 18:10:55 +02:00
|
|
|
pip3 install -U pip setuptools wheel pyyaml --no-cache-dir
|
|
|
|
ynh_exec_fully_quiet pip3 install -e "$install_dir/searxng-src"
|
2022-11-23 10:08:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
# SYSTEM CONFIGURATION
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2023-09-18 18:10:55 +02:00
|
|
|
ynh_add_nginx_config
|
2022-11-23 10:08:54 +01:00
|
|
|
|
2023-09-27 22:08:09 +02:00
|
|
|
ynh_add_uwsgi_service
|
|
|
|
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
2023-09-18 18:10:55 +02:00
|
|
|
# APP INITIAL CONFIGURATION
|
2022-11-23 10:08:54 +01:00
|
|
|
#=================================================
|
|
|
|
# ADD A CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
|
|
|
2022-11-23 12:46:39 +01:00
|
|
|
secret_key=$(ynh_string_random)
|
2023-09-27 22:08:09 +02:00
|
|
|
ynh_add_config --template="../conf/settings.yml" --destination="$install_dir/settings.yml"
|
2023-02-08 00:06:00 +01:00
|
|
|
|
2023-09-27 22:08:09 +02:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app: "$install_dir"
|
2022-11-23 10:08:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
|
2023-09-18 18:10:55 +02:00
|
|
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --line_match="WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path="/var/log/uwsgi/$app/$app.log"
|
2022-11-23 10:08:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|