2016-03-28 22:14:19 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-03-03 18:12:41 +01:00
|
|
|
source _common.sh
|
2017-06-02 17:15:57 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_app_setting_set --key=php_upload_max_filesize --value=256M
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_script_progression "Setting up source files..."
|
2017-08-26 03:24:41 +02:00
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-05-03 16:16:05 +02:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2016-05-17 13:15:38 +02:00
|
|
|
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_script_progression "Configuring NGINX web server..."
|
2017-08-26 03:24:41 +02:00
|
|
|
|
2020-09-27 22:39:12 +02:00
|
|
|
# Create a dedicated NGINX config
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_config_add_nginx
|
2017-08-26 03:24:41 +02:00
|
|
|
|
2022-09-30 18:31:12 +02:00
|
|
|
# Create a dedicated php-fpm config
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_config_add_phpfpm
|
2017-08-26 03:24:41 +02:00
|
|
|
|
2019-03-03 18:12:41 +01:00
|
|
|
# Install composer
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_composer_install
|
2017-08-26 03:24:41 +02:00
|
|
|
|
2024-07-18 17:03:10 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC SETUP
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
|
|
|
# INITIALIZE DATABASE
|
|
|
|
#=================================================
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_script_progression "Initializing database..."
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_mysql_db_shell < "$install_dir/SQL/mysql.initial.sql"
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
|
|
|
# CONFIGURE ROUNDCUBE
|
|
|
|
#=================================================
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_script_progression "Configuring Roundcube..."
|
2019-03-03 18:13:57 +01:00
|
|
|
|
2021-08-28 13:31:36 +02:00
|
|
|
deskey=$(ynh_string_random --length=24)
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_config_add --template="config.inc.php" --destination="$install_dir/config/config.inc.php"
|
2017-08-26 03:24:41 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# INSTALL ADDITIONAL PLUGINS
|
|
|
|
#=================================================
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_script_progression "Installing additional plugins..."
|
2017-08-26 03:24:41 +02:00
|
|
|
|
2020-04-24 13:51:14 +02:00
|
|
|
# Install net_LDAP
|
2023-12-03 00:24:45 +01:00
|
|
|
export COMPOSER_ALLOW_SUPERUSER=1
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_composer_exec require kolab/net_ldap3
|
2020-04-24 13:51:14 +02:00
|
|
|
|
2017-08-26 03:24:41 +02:00
|
|
|
# Install contextmenu and automatic_addressbook plugins
|
|
|
|
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
|
|
|
|
# https://plugins.roundcube.net/packages/johndoh/contextmenu
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_composer_exec require \
|
2019-03-03 18:12:41 +01:00
|
|
|
johndoh/contextmenu $contextmenu_version \
|
2024-07-18 16:56:29 +02:00
|
|
|
sblaisot/automatic_addressbook $automatic_addressbook_version
|
2019-03-03 18:12:41 +01:00
|
|
|
|
2021-08-27 12:15:31 +02:00
|
|
|
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
|
2021-08-27 12:09:03 +02:00
|
|
|
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_config_add --template="enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
|
2023-05-03 16:16:05 +02:00
|
|
|
mkdir -p "$install_dir/plugins/enigma/home"
|
|
|
|
chown -R $app:www-data "$install_dir/plugins/enigma/home"
|
2016-03-30 14:38:37 +02:00
|
|
|
|
2017-06-18 01:53:14 +02:00
|
|
|
# Install CardDAV plugin
|
2019-03-03 18:12:41 +01:00
|
|
|
if [ $with_carddav -eq 1 ]
|
|
|
|
then
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_composer_exec require roundcube/carddav $carddav_version --with-all-dependencies
|
2019-03-03 18:12:41 +01:00
|
|
|
|
|
|
|
carddav_tmp_config="../conf/carddav.config.inc.php"
|
2020-04-24 13:31:55 +02:00
|
|
|
carddav_server=0
|
2019-03-03 18:12:41 +01:00
|
|
|
|
2020-11-22 14:05:49 +01:00
|
|
|
# Copy the plugin configuration file
|
2023-05-03 16:16:05 +02:00
|
|
|
cp $install_dir/plugins/carddav/config.inc.php{.dist,}
|
2020-11-22 14:05:49 +01:00
|
|
|
|
2019-03-03 18:12:41 +01:00
|
|
|
# Look for installed and supported CardDAV servers
|
2020-09-27 22:39:12 +02:00
|
|
|
for carddav_app in "nextcloud" "baikal"
|
2019-03-03 18:12:41 +01:00
|
|
|
do
|
2020-11-22 14:05:49 +01:00
|
|
|
carddav_app_ids=$(yunohost app list | grep "id: $carddav_app" | grep -Po 'id: \K(.*)' || echo "")
|
|
|
|
for carddav_app_id in $carddav_app_ids
|
|
|
|
do
|
2020-04-24 13:31:55 +02:00
|
|
|
carddav_server=1
|
2020-11-22 14:05:49 +01:00
|
|
|
# Append preset configuration to the config file
|
2023-05-03 16:16:05 +02:00
|
|
|
cat "../conf/${carddav_app}.inc.php" >> $install_dir/plugins/carddav/config.inc.php
|
2019-03-03 18:12:41 +01:00
|
|
|
# Retrieve app settings and enable relevant preset
|
2023-05-03 16:25:14 +02:00
|
|
|
carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
|
|
|
|
carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
|
2019-03-03 18:12:41 +01:00
|
|
|
carddav_url="https://${carddav_domain}${carddav_path%/}"
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_replace --match="{${carddav_app}_id}" --replace="$carddav_app_id" --file="$install_dir/plugins/carddav/config.inc.php"
|
|
|
|
ynh_replace --match="{${carddav_app}_url}" --replace="$carddav_url" --file="$install_dir/plugins/carddav/config.inc.php"
|
2020-11-22 14:05:49 +01:00
|
|
|
done
|
2019-03-03 18:12:41 +01:00
|
|
|
done
|
|
|
|
|
2021-08-27 10:17:09 +02:00
|
|
|
# Do not actualy add the cardDAV plugin if there's no cardDAV server available...
|
2020-04-24 13:31:55 +02:00
|
|
|
if [ $carddav_server -eq 1 ]
|
|
|
|
then
|
|
|
|
installed_plugins+=" 'carddav',"
|
|
|
|
fi
|
2016-05-15 23:51:33 +02:00
|
|
|
fi
|
|
|
|
|
2017-08-26 03:24:41 +02:00
|
|
|
#=================================================
|
|
|
|
# UPDATE ROUNDCUBE CONFIGURATION
|
|
|
|
#=================================================
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_script_progression "Updating Roundcube configuration..."
|
2017-08-26 03:24:41 +02:00
|
|
|
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_replace --match="^\s*// installed plugins" --replace="&\n $installed_plugins" --file="$install_dir/config/config.inc.php"
|
2017-06-02 17:15:57 +02:00
|
|
|
|
2017-07-03 13:12:59 +02:00
|
|
|
# Update javascript dependencies
|
2024-07-18 17:03:10 +02:00
|
|
|
# (REMOVEME? -> already done in the -complete.tar.gz archive)
|
|
|
|
#(cd "$install_dir"
|
|
|
|
#/usr/bin/php$php_version -q ./bin/install-jsdeps.sh -v ?)
|
2017-07-03 13:12:59 +02:00
|
|
|
|
2021-08-18 19:20:42 +02:00
|
|
|
# Store the config file checksum into the app settings
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_store_file_checksum "$install_dir/config/config.inc.php"
|
2021-08-26 22:11:23 +02:00
|
|
|
|
2019-03-03 18:13:57 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-07-18 16:56:29 +02:00
|
|
|
ynh_script_progression "Installation of $app completed"
|