|
|
@ -1,7 +1,7 @@
|
|
|
|
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
@ -10,10 +10,10 @@ source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# MANAGE FAILURE OF THE SCRIPT
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script.
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
@ -39,15 +39,15 @@ language=$YNH_APP_ARG_LANGUAGE
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
|
|
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
|
|
|
|
# Normalize the url path syntax
|
|
|
|
# Normalize the url path syntax
|
|
|
|
path_url=$(ynh_normalize_url_path $path_url)
|
|
|
|
path_url=$(ynh_normalize_url_path $path_url)
|
|
|
|
|
|
|
|
|
|
|
|
# Check availability of a web path
|
|
|
|
# Check web path availability
|
|
|
|
ynh_webpath_available $domain $path_url
|
|
|
|
ynh_webpath_available $domain $path_url
|
|
|
|
# Register/book a web path for an app
|
|
|
|
# Register (book) web path
|
|
|
|
ynh_webpath_register $app $domain $path_url
|
|
|
|
ynh_webpath_register $app $domain $path_url
|
|
|
|
|
|
|
|
|
|
|
|
final_path=/var/www/$app
|
|
|
|
final_path=/var/www/$app
|
|
|
@ -82,10 +82,10 @@ ynh_app_setting_set $app port $port
|
|
|
|
ynh_install_app_dependencies deb1 deb2
|
|
|
|
ynh_install_app_dependencies deb1 deb2
|
|
|
|
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# CREATE A SQL BDD
|
|
|
|
# CREATE A MYSQL DATABASE
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# If your app use a MySQL database you can use these lines to bootstrap
|
|
|
|
# If your app uses a MySQL database, you can use these lines to bootstrap
|
|
|
|
# a database, an associated user and save the password in app settings.
|
|
|
|
# a database, an associated user and save the password in app settings
|
|
|
|
|
|
|
|
|
|
|
|
db_name=$(ynh_sanitize_dbid $app)
|
|
|
|
db_name=$(ynh_sanitize_dbid $app)
|
|
|
|
ynh_app_setting_set $app db_name $db_name
|
|
|
|
ynh_app_setting_set $app db_name $db_name
|
|
|
@ -134,13 +134,13 @@ ynh_fpm_config
|
|
|
|
ynh_systemd_config
|
|
|
|
ynh_systemd_config
|
|
|
|
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# SETTING UP WITH CURL
|
|
|
|
# SETUP APPLICATION WITH CURL
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
|
|
|
|
# Set right permissions for curl install
|
|
|
|
# Set right permissions for curl install
|
|
|
|
sudo chown -R $app: $final_path
|
|
|
|
sudo chown -R $app: $final_path
|
|
|
|
|
|
|
|
|
|
|
|
# Put the app public for curl
|
|
|
|
# Set the app as temporarily public for curl call
|
|
|
|
ynh_app_setting_set $app unprotected_uris "/"
|
|
|
|
ynh_app_setting_set $app unprotected_uris "/"
|
|
|
|
# Reload SSOwat config
|
|
|
|
# Reload SSOwat config
|
|
|
|
sudo yunohost app ssowatconf
|
|
|
|
sudo yunohost app ssowatconf
|
|
|
@ -159,9 +159,9 @@ ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
|
|
|
|
ynh_store_file_checksum "$final_path/CONFIG_FILE"
|
|
|
|
ynh_store_file_checksum "$final_path/CONFIG_FILE"
|
|
|
|
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# SECURING FILES AND DIRECTORIES
|
|
|
|
# SECURE FILES AND DIRECTORIES
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
|
|
|
|
# Set permissions to app files
|
|
|
|
# Set permissions to app files
|
|
|
@ -171,11 +171,11 @@ sudo chown -R root: $final_path
|
|
|
|
# SETUP LOGROTATE
|
|
|
|
# SETUP LOGROTATE
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
|
|
|
|
# Use logrotate to manage the logfile
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
|
|
ynh_use_logrotate
|
|
|
|
ynh_use_logrotate
|
|
|
|
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# ENABLE SERVICE IN ADMIN PANEL
|
|
|
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
|
|
|
|
sudo yunohost service add NAME_INIT.D --log "/var/log/FILE.log"
|
|
|
|
sudo yunohost service add NAME_INIT.D --log "/var/log/FILE.log"
|
|
|
|