qr_ynh/scripts/install

42 lines
1.3 KiB
Plaintext
Raw Normal View History

2019-08-12 23:55:33 +02:00
#!/bin/bash
source _common.sh
2019-08-12 23:55:33 +02:00
source /usr/share/yunohost/helpers
ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
2022-03-05 18:08:29 +01:00
is_public=$YNH_APP_ARG_IS_PUBLIC
2019-08-13 21:35:51 +02:00
app=$YNH_APP_INSTANCE_NAME
2019-08-12 23:55:33 +02:00
2020-10-25 16:31:23 +01:00
ynh_script_progression --message="Validating installation parameters..."
2019-08-13 21:35:51 +02:00
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
2019-08-12 23:55:33 +02:00
2020-10-25 16:31:23 +01:00
ynh_script_progression --message="Storing installation settings..."
2019-08-13 21:35:51 +02:00
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
2022-03-05 02:39:55 +01:00
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
2022-03-03 17:58:37 +01:00
ynh_script_progression --message="Configuring system user..."
ynh_system_user_create --username=$app --home_dir="$final_path"
2020-10-25 16:31:23 +01:00
ynh_script_progression --message="Setting up source files..."
2019-08-13 21:35:51 +02:00
ynh_setup_source --dest_dir="$final_path"
libreqr_apply_filesystem_permissions
2022-03-03 17:58:37 +01:00
ynh_script_progression --message="Configuring NGINX web server..."
2019-08-12 23:55:33 +02:00
ynh_add_nginx_config
2022-03-03 17:58:37 +01:00
ynh_script_progression --message="Configuring PHP-FPM..."
2022-06-07 23:12:44 +02:00
ynh_add_fpm_config
2019-08-13 21:35:51 +02:00
2022-03-05 18:08:29 +01:00
ynh_script_progression --message="Configuring permissions..."
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
2020-10-25 16:31:23 +01:00
ynh_script_progression --message="Installation of $app completed" --last