2020-05-04 19:15:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2023-03-10 22:48:26 +01:00
|
|
|
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
2020-05-04 19:15:22 +02:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2023-03-10 22:48:26 +01:00
|
|
|
ynh_script_progression --message="Setting up source files..." --time --weight=
|
2020-05-04 19:15:22 +02:00
|
|
|
|
2023-03-10 22:48:26 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2020-05-04 19:15:22 +02:00
|
|
|
|
2023-03-10 22:48:26 +01:00
|
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
find "$install_dir" -type f -exec chmod 640 {} \;
|
|
|
|
find "$install_dir" -type d -exec chmod 750 {} \;
|
|
|
|
find "$install_dir" -type d -exec chmod +s {} \;
|
2020-05-04 19:15:22 +02:00
|
|
|
|
|
|
|
#=================================================
|
2023-03-10 22:48:26 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2020-05-04 19:15:22 +02:00
|
|
|
#=================================================
|
2023-03-10 22:48:26 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1
|
2020-05-04 19:15:22 +02:00
|
|
|
|
2023-03-10 22:48:26 +01:00
|
|
|
ynh_add_fpm_config
|
2020-05-04 19:15:22 +02:00
|
|
|
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2023-03-10 22:48:26 +01:00
|
|
|
ynh_use_logrotate
|
2020-05-04 19:15:22 +02:00
|
|
|
|
|
|
|
#=================================================
|
2023-03-10 22:48:26 +01:00
|
|
|
# APP INITIAL CONFIGURATION
|
2020-05-04 19:15:22 +02:00
|
|
|
#=================================================
|
|
|
|
# SETUP APPLICATION WITH CURL
|
|
|
|
#=================================================
|
2023-03-10 22:48:26 +01:00
|
|
|
ynh_script_progression --message="Finalizing installation..." --weight=1
|
2020-05-04 19:15:22 +02:00
|
|
|
|
2023-03-10 22:48:26 +01:00
|
|
|
installLanguage="$language"
|
|
|
|
installUrl="/?install/postinstall/$installLanguage"
|
|
|
|
installId="$admin"
|
|
|
|
installPassword="${password}"
|
|
|
|
installMail=$(ynh_user_get_info --username="$admin" --key=mail)
|
|
|
|
installFirstname=$(ynh_user_get_info --username="$admin" --key=fullname | awk -F' ' '{print $1}')
|
|
|
|
installLastname=$(ynh_user_get_info --username="$admin" --key=fullname | awk -F' ' '{print $2}')
|
2020-05-04 19:15:22 +02:00
|
|
|
|
2023-03-10 22:48:26 +01:00
|
|
|
csrf=$(ynh_local_curl "${installUrl}" | grep "csrf" | awk -F'value="' '{print $2}' | awk -F'"' '{print $1}')
|
2020-05-04 19:15:22 +02:00
|
|
|
|
2023-03-10 22:48:26 +01:00
|
|
|
ynh_local_curl "${installUrl}" "csrf=${csrf}" "installId=${installId}" "installPassword=${installPassword}" "installConfirmPassword=${installPassword}" "installMail=${installMail}" "installFirstname=${installFirstname}" "installLastname=${installLastname}" "installLanguage=${installLanguage}"
|
2020-05-04 19:15:22 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2023-03-10 22:48:26 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|