1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mediawiki_ynh.git synced 2024-09-03 19:46:05 +02:00
mediawiki_ynh/scripts/install

104 lines
3.5 KiB
Text
Raw Normal View History

2019-02-27 23:52:47 +01:00
#!/bin/bash
#=================================================
# GENERIC START
2019-02-27 23:52:47 +01:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2019-02-27 23:52:47 +01:00
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
2022-04-13 01:23:40 +02:00
secret=$(ynh_string_random --length=64)
ynh_app_setting_set --app=$app --key=secret --value=$secret
2019-02-27 23:52:47 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
2019-02-27 23:52:47 +01:00
# Download, check integrity, uncompress and patch the source from app.src
2023-04-10 16:26:24 +02:00
ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir/extensions/" --source_id="ldap_authentication2"
ynh_setup_source --dest_dir="$install_dir/extensions/" --source_id="ldap_provider"
ynh_setup_source --dest_dir="$install_dir/extensions/" --source_id="pluggable_auth"
# Note(decentral1se): Disabled and unused for now ...
2023-04-10 16:26:24 +02:00
# ynh_setup_source --dest_dir="$install_dir/extensions/" --source_id="ldap_groups"
# ynh_setup_source --dest_dir="$install_dir/extensions/" --source_id="ldap_userinfo"
# ynh_setup_source --dest_dir="$install_dir/extensions/" --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
#=================================================
# SPECIFIC SETUP
2019-02-27 23:52:47 +01:00
#=================================================
# RUN INSTALLATION OF MEDIAWIKI
2019-02-27 23:52:47 +01: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
2021-05-19 18:18:33 +02:00
scriptpath=""
else
2023-04-10 16:26:24 +02:00
scriptpath=$path
fi
2023-04-10 16:26:24 +02:00
"php$phpversion" "$install_dir/maintenance/install.php" --conf "$install_dir" \
2021-05-19 18:18:33 +02:00
--server "https://$domain" \
--scriptpath "$scriptpath" \
--dbuser "$db_name" \
--dbpass "$db_pwd" \
--dbname "$db_name" \
--dbprefix "mdk_" \
--lang "$language" \
2023-04-10 18:11:11 +02:00
--pass "$password" \
2021-05-19 18:18:33 +02:00
"$wiki_name" "$admin"
#=================================================
2022-04-13 01:23:40 +02:00
# ADD A CONFIGURATION
#=================================================
2022-04-13 01:23:40 +02:00
ynh_script_progression --message="Adding a configuration file..."
2023-04-10 16:26:24 +02:00
if [ "$path" = "/" ]; then
2021-05-19 18:18:33 +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
2022-04-13 01:23:40 +02:00
mediawiki_path=""
else
2023-04-10 16:26:24 +02:00
mediawiki_path="$path"
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"
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
#=================================================
ynh_script_progression --message="Installation of $app completed" --last