mirror of
https://github.com/YunoHost-Apps/spip_ynh.git
synced 2024-09-03 20:25:59 +02:00
99 lines
4.4 KiB
Bash
99 lines
4.4 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..."
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# PHP-FPM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring PHP-FPM..."
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
ynh_add_fpm_config --usage=low --footprint=low
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# SETUP APPLICATION WITH CURL
|
|
#=================================================
|
|
ynh_script_progression --message="Setuping application with cURL..."
|
|
|
|
# Set right permissions for curl install
|
|
mkdir -p $install_dir/plugins/auto
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
# Set the app as temporarily public for curl call
|
|
ynh_script_progression --message="Configuring SSOwat..."
|
|
|
|
# Installation with cURL
|
|
ynh_script_progression --message="Finalizing installation..."
|
|
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=chmod"
|
|
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=750" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql"
|
|
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "choix_db=$db_name" "tprefix=$db_name"
|
|
|
|
# For now spip have a problem with LDAP
|
|
#ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap1"
|
|
#ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap2" "adresse_ldap=localhost" "port_ldap=389" "tls_ldap=no" "protocole_ldap=3"
|
|
#ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap3" "adresse_ldap=localhost" "port_ldap=389" "tls_ldap=no" "protocole_ldap=3"
|
|
#ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap4" "adresse_ldap=localhost" "port_ldap=389" "tls_ldap=no" "protocole_ldap=3" "base_ldap=dc=yunohost,dc=org"
|
|
#
|
|
## statut_ldap can take: 0minirezo for Administrator, 1comite for Editor, 6forum for Visitor
|
|
#if [ $users_status = "Administrator" ]; then
|
|
# status="0minirezo"
|
|
#elif [ $users_status = "Editor" ]; then
|
|
# status="1comite"
|
|
#else
|
|
# status="6forum"
|
|
#fi
|
|
#ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap5" "adresse_ldap=localhost" "port_ldap=389" "tls_ldap=no" "protocole_ldap=3" "base_ldap=dc=yunohost,dc=org" "statut_ldap=$status" "ldap_login=sAMAccountName,uid,login,userid,cn,sn" "ldap_nom=cn" "ldap_email=mail" "ldap_bio=description"
|
|
#ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "ldap_present=true"
|
|
|
|
# Fix db initialization
|
|
ynh_local_curl "/ecrire/?exec=install" "etape=3b"
|
|
|
|
email=$(yunohost user info $admin | grep mail: | cut -d' ' -f2 | tr -d '\n')
|
|
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3b" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "sel_db=$db_name" "nom=$admin" "email=$email" "login=$admin" "pass=$password" "pass_verif=$password"
|
|
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=fin"
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..."
|
|
|
|
#ynh_replace_string "'','utf8');" "'ldap.php','utf8');" $install_dir/config/connect.php
|
|
cp ../conf/mes_options.php $install_dir/config/mes_options.php
|
|
|
|
# Add security fix https://www.spip.net/en_article4201.html to be removed after version 4.2.2
|
|
cp ../conf/ecran_securite.php $install_dir/config/ecran_securite.php
|
|
|
|
#=================================================
|
|
# STORE THE CONFIG FILE CHECKSUM
|
|
#=================================================
|
|
|
|
ynh_store_file_checksum --file="$install_dir/config/connect.php"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|