#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= secret=$(ynh_string_random --length=64) create_account=false ynh_app_setting_set --app=$app --key=secret --value=$secret ynh_app_setting_set --app=$app --key=create_account --value=$create_account #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=4 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir/extensions/LDAPAuthentication2" --source_id="ldap_authentication2" ynh_setup_source --dest_dir="$install_dir/extensions/LDAPProvider" --source_id="ldap_provider" ynh_setup_source --dest_dir="$install_dir/extensions/PluggableAuth" --source_id="pluggable_auth" # ynh_setup_source --dest_dir="$install_dir/extensions/LDAPGroups" --source_id="ldap_groups" # ynh_setup_source --dest_dir="$install_dir/extensions/LDAPUserInfo" --source_id="ldap_userinfo" # ynh_setup_source --dest_dir="$install_dir/extensions/LDAPAuthorization" --source_id="ldap_authorization" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= # RUN INSTALLATION OF MEDIAWIKI #================================================= ynh_script_progression --message="Installing and configuring Mediawiki..." --weight=14 if [ "$path" = "/" ]; then scriptpath="" else scriptpath=$path fi wiki_name_underscorified="${wiki_name//[^a-zA-Z0-9]/_}" "php$phpversion" "$install_dir/maintenance/install.php" --conf "$install_dir" \ --server "https://$domain" \ --scriptpath "$scriptpath" \ --dbuser "$db_name" \ --dbpass "$db_pwd" \ --dbname "$db_name" \ --dbprefix "mdk_" \ --lang "$language" \ --pass "$password" \ "$wiki_name" "$admin" #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." if [ "$path" = "/" ]; then # MediaWiki expects a "" for the root URL which is typically assumed to be # "/" by other application packages. Therefore, we assume end-users will do # this as well and make sure to ensure an "" in all cases where "/" is # specified mediawiki_path="" else mediawiki_path="$path" fi ynh_add_config --template="../conf/LocalSettings.php" --destination="$install_dir/LocalSettings.php" # This is required to update database schemas "php$phpversion" "$install_dir/maintenance/update.php" chown -R $app:www-data "$install_dir" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last