#!/bin/bash #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers ynh_app_setting_set --key=php_upload_max_filesize --value=256M #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= secret=$(ynh_string_random --length=64) create_account=false ynh_app_setting_set --key="secret" --value="$secret" ynh_app_setting_set --key="create_account" --value="$create_account" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression "Setting up source files..." # 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" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" #================================================= # RUN INSTALLATION OF MEDIAWIKI #================================================= ynh_script_progression "Installing and configuring Mediawiki..." 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 pushd "$install_dir" "php$php_version" "$install_dir/maintenance/install.php" \ --server "https://$domain" \ --scriptpath "$mediawiki_path" \ --dbuser "$db_name" \ --dbpass "$db_pwd" \ --dbname "$db_name" \ --dbprefix "mdk_" \ --lang "$language" \ --pass "$password" \ "$wiki_name" "$admin" popd #================================================= # APP INITIAL CONFIGURATION #================================================= ynh_script_progression "Adding $app's configuration files..." # save the original LocalSettings.php for eventual debugging mv "$install_dir/LocalSettings.php" "$install_dir/LocalSettings.php.orig" wiki_name_underscorified="${wiki_name//[^a-zA-Z0-9]/_}" ynh_config_add --template="LocalSettings.php" --destination="$install_dir/LocalSettings.php" # This is required to update database schemas "php$php_version" "$install_dir/maintenance/update.php" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression "Adding system configurations related to $app..." # Create a dedicated PHP-FPM config ynh_config_add_phpfpm # Create a dedicated NGINX config ynh_config_add_nginx #================================================= # END OF SCRIPT #================================================= ynh_script_progression "Installation of $app completed"