2019-02-27 23:52:47 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-06-10 15:24:30 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
2019-02-27 23:52:47 +01:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2020-06-10 15:24:30 +02:00
|
|
|
|
2019-02-27 23:52:47 +01:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
|
|
#=================================================
|
2020-06-10 15:24:30 +02:00
|
|
|
|
2022-04-13 01:23:40 +02:00
|
|
|
secret=$(ynh_string_random --length=64)
|
2022-11-13 23:39:11 +01:00
|
|
|
create_account=false
|
|
|
|
|
2022-04-13 01:23:40 +02:00
|
|
|
ynh_app_setting_set --app=$app --key=secret --value=$secret
|
2022-11-13 23:39:11 +01:00
|
|
|
ynh_app_setting_set --app=$app --key=create_account --value=$create_account
|
2019-02-27 23:52:47 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2019-07-27 22:09:37 +02:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=4
|
2019-02-27 23:52:47 +01:00
|
|
|
|
2023-09-04 13:19:22 +02:00
|
|
|
# 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"
|
2023-05-26 20:39:50 +02:00
|
|
|
|
2023-09-04 13:19:22 +02:00
|
|
|
# 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"
|
2019-02-27 23:52:47 +01:00
|
|
|
|
2023-04-10 16:26:24 +02:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-05-16 17:29:40 +02:00
|
|
|
|
2019-02-27 23:52:47 +01:00
|
|
|
#=================================================
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
2020-12-16 22:30:16 +01:00
|
|
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
2019-02-27 23:52:47 +01:00
|
|
|
|
2020-12-16 22:30:16 +01:00
|
|
|
# Create a dedicated PHP-FPM config
|
2021-12-08 20:08:43 +01:00
|
|
|
ynh_add_fpm_config --usage=low --footprint=low
|
2019-02-27 23:52:47 +01:00
|
|
|
|
2022-06-18 18:51:02 +02:00
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2019-02-27 23:52:47 +01:00
|
|
|
#=================================================
|
2020-06-10 15:24:30 +02:00
|
|
|
# SPECIFIC SETUP
|
2019-02-27 23:52:47 +01:00
|
|
|
#=================================================
|
2019-07-27 22:09:37 +02:00
|
|
|
# RUN INSTALLATION OF MEDIAWIKI
|
2019-02-27 23:52:47 +01:00
|
|
|
#=================================================
|
2020-06-10 15:24:30 +02:00
|
|
|
ynh_script_progression --message="Installing and configuring Mediawiki..." --weight=14
|
2023-04-10 16:33:31 +02:00
|
|
|
|
2023-04-10 16:26:24 +02:00
|
|
|
if [ "$path" = "/" ]; then
|
2023-09-04 13:19:22 +02:00
|
|
|
scriptpath=""
|
2019-02-28 22:45:05 +01:00
|
|
|
else
|
2023-09-04 13:19:22 +02:00
|
|
|
scriptpath=$path
|
2019-02-28 22:45:05 +01:00
|
|
|
fi
|
|
|
|
|
2023-04-10 16:26:24 +02:00
|
|
|
"php$phpversion" "$install_dir/maintenance/install.php" --conf "$install_dir" \
|
2023-09-04 13:19:22 +02:00
|
|
|
--server "https://$domain" \
|
|
|
|
--scriptpath "$scriptpath" \
|
|
|
|
--dbuser "$db_name" \
|
|
|
|
--dbpass "$db_pwd" \
|
|
|
|
--dbname "$db_name" \
|
|
|
|
--dbprefix "mdk_" \
|
|
|
|
--lang "$language" \
|
|
|
|
--pass "$password" \
|
|
|
|
"$wiki_name" "$admin"
|
2019-07-27 22:09:37 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-04-13 01:23:40 +02:00
|
|
|
# ADD A CONFIGURATION
|
2019-07-27 22:09:37 +02:00
|
|
|
#=================================================
|
2022-04-13 01:23:40 +02:00
|
|
|
ynh_script_progression --message="Adding a configuration file..."
|
2019-07-27 22:09:37 +02:00
|
|
|
|
2023-04-10 16:26:24 +02:00
|
|
|
if [ "$path" = "/" ]; then
|
2023-09-04 13:19:22 +02:00
|
|
|
# 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=""
|
2019-07-27 22:09:37 +02:00
|
|
|
else
|
2023-09-04 13:19:22 +02:00
|
|
|
mediawiki_path="$path"
|
2019-07-27 22:09:37 +02:00
|
|
|
fi
|
2019-02-27 23:52:47 +01:00
|
|
|
|
2023-04-10 16:26:24 +02:00
|
|
|
ynh_add_config --template="../conf/LocalSettings.php" --destination="$install_dir/LocalSettings.php"
|
2020-06-10 15:24:30 +02:00
|
|
|
|
2023-09-15 16:22:18 +02:00
|
|
|
# This is required to update database schemas
|
2023-04-10 16:26:24 +02:00
|
|
|
"php$phpversion" "$install_dir/maintenance/update.php"
|
2019-02-27 23:52:47 +01:00
|
|
|
|
2023-04-10 16:26:24 +02:00
|
|
|
chown -R $app:www-data "$install_dir"
|
2019-02-27 23:52:47 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2020-06-10 15:24:30 +02:00
|
|
|
|
2019-07-27 22:09:37 +02:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|