2020-04-16 14:08:38 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2020-11-28 15:37:48 +01:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=5
|
2020-04-16 14:08:38 +02:00
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-06-14 10:41:57 +02:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2020-04-16 14:08:38 +02:00
|
|
|
|
2023-12-10 10:28:07 +01:00
|
|
|
chown -R $app:www-data $install_dir
|
|
|
|
chmod -R u=rwX,g=rX,o-rwx $install_dir
|
2022-07-07 03:08:58 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
2023-07-10 08:53:40 +02:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1
|
2022-07-07 03:08:58 +02:00
|
|
|
|
|
|
|
# Create a dedicated PHP-FPM config
|
2023-07-10 08:53:40 +02:00
|
|
|
ynh_add_fpm_config --usage=low --footprint=low
|
2020-04-16 14:08:38 +02:00
|
|
|
|
2020-10-06 13:58:22 +02:00
|
|
|
# Create a dedicated NGINX config
|
2020-04-16 14:08:38 +02:00
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
2022-07-07 03:08:58 +02:00
|
|
|
# SPECIFIC SETUP
|
2020-04-16 14:08:38 +02:00
|
|
|
#=================================================
|
2022-07-07 03:08:58 +02:00
|
|
|
# INSTALL COMPOSER DEPENDENCIES
|
|
|
|
#=================================================
|
2023-07-02 18:39:53 +02:00
|
|
|
ynh_script_progression --message="Installing composer dependencies..."
|
2020-04-16 14:08:38 +02:00
|
|
|
|
2023-06-14 10:41:57 +02:00
|
|
|
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir"
|
2020-04-16 14:08:38 +02:00
|
|
|
|
2020-04-27 11:37:38 +02:00
|
|
|
#=================================================
|
|
|
|
# SETUP APPLICATION WITH CURL
|
|
|
|
#=================================================
|
2020-04-16 14:08:38 +02:00
|
|
|
|
2020-04-27 11:37:38 +02:00
|
|
|
# Installation with curl
|
2020-11-28 15:37:48 +01:00
|
|
|
ynh_script_progression --message="Finalizing installation..." --weight=2
|
2020-11-27 15:25:28 +01:00
|
|
|
|
2021-03-03 10:13:21 +01:00
|
|
|
admin_temp_pass=$(ynh_string_random 6)
|
|
|
|
|
2020-11-27 15:25:28 +01:00
|
|
|
ynh_local_curl "/?PagePrincipale&installAction=install" "config[default_language]=$language" "config[wakka_name]=$wiki_name" \
|
2020-04-21 19:52:06 +02:00
|
|
|
"config[root_page]=PagePrincipale" "config[mysql_host]=localhost" \
|
|
|
|
"config[mysql_database]=$app" "config[mysql_user]=$db_user" "config[mysql_password]=$db_pwd" "config[table_prefix]=yeswiki_" \
|
2021-03-03 10:13:21 +01:00
|
|
|
"admin_name=$admin" "admin_password=$admin_temp_pass" "admin_password_conf=$admin_temp_pass" \
|
2022-03-08 17:00:38 +01:00
|
|
|
"admin_email=$admin%40$domain" "submit=Continue"
|
2020-04-27 11:37:38 +02:00
|
|
|
|
2020-11-21 20:56:29 +01:00
|
|
|
# authorization of html
|
2023-06-14 10:41:57 +02:00
|
|
|
ynh_replace_string --match_string="'allow_raw_html' => false," --replace_string="'allow_raw_html' => true," --target_file="$install_dir/wakka.config.php"
|
2020-11-21 20:56:29 +01:00
|
|
|
|
2023-06-14 10:41:57 +02:00
|
|
|
ynh_replace_string --match_string="yeswiki_release' \?=> \?'.*',$" --replace_string="yeswiki_release' => '$(ynh_app_upstream_version)'," --target_file="$install_dir/wakka.config.php"
|
2022-07-07 03:08:58 +02:00
|
|
|
|
2021-02-18 18:22:14 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD AND CONFIGURE LDAP PLUGIN
|
|
|
|
#=================================================
|
2021-03-01 17:02:55 +01:00
|
|
|
ynh_script_progression --message="Dowloading and configuring LDAP plugin" --weight=2
|
2021-02-18 18:22:14 +01:00
|
|
|
|
2021-03-01 17:02:55 +01:00
|
|
|
# Download from yeswiki repository
|
2021-03-25 09:51:24 +01:00
|
|
|
wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip 2>&1
|
|
|
|
wget https://repository.yeswiki.net/doryphore/extension-loginldap-$loginldap_version.zip.md5 2>&1
|
2021-03-01 17:02:55 +01:00
|
|
|
md5sum -c extension-loginldap-$loginldap_version.zip.md5 || ynh_die "Checksum for LDAP plugin does not match"
|
|
|
|
|
2023-06-14 10:41:57 +02:00
|
|
|
unzip extension-loginldap-$loginldap_version.zip -d $install_dir/tools
|
2021-03-01 17:02:55 +01:00
|
|
|
|
|
|
|
ynh_app_setting_set --app=$app --key=loginldap_version --value=$loginldap_version
|
2021-02-18 18:22:14 +01:00
|
|
|
|
|
|
|
# Add config at the end of wakka.config.php
|
2023-06-14 10:41:57 +02:00
|
|
|
ynh_replace_string --match_string=");" --replace_string=" 'ldap_host' => '127.0.0.1',\n);" --target_file="$install_dir/wakka.config.php"
|
2021-02-18 18:22:14 +01:00
|
|
|
|
2023-06-14 10:41:57 +02:00
|
|
|
ynh_replace_string --match_string=");" --replace_string=" 'ldap_port' => '389',\n);" --target_file="$install_dir/wakka.config.php"
|
2021-02-18 18:22:14 +01:00
|
|
|
|
2023-06-14 10:41:57 +02:00
|
|
|
ynh_replace_string --match_string=");" --replace_string=" 'ldap_base' => 'ou=users,dc=yunohost,dc=org'\n);" --target_file="$install_dir/wakka.config.php"
|
2021-02-18 18:22:14 +01:00
|
|
|
|
2020-04-16 14:08:38 +02:00
|
|
|
#=================================================
|
|
|
|
# SECURE FILES AND DIRECTORIES
|
|
|
|
#=================================================
|
|
|
|
|
2023-12-10 10:28:07 +01:00
|
|
|
chown -R $app:www-data $install_dir
|
|
|
|
chmod -R u=rwX,g=rX,o-rwx $install_dir
|
|
|
|
chmod g-rwx $install_dir/wakka.config.php
|
2021-04-16 14:03:40 +02:00
|
|
|
|
2020-04-16 14:08:38 +02:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-11-05 22:50:45 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|