2018-02-06 14:33:23 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-11 00:32:26 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
2018-02-06 14:33:23 +01:00
|
|
|
# IMPORT GENERIC HELPERS
|
2022-03-09 00:27:32 +01:00
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
2018-02-06 14:33:23 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2022-03-09 00:27:32 +01:00
|
|
|
#=================================================
|
2023-12-02 16:49:04 +01:00
|
|
|
# OPTIONAL APPS
|
2022-03-09 00:27:32 +01:00
|
|
|
#=================================================
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
# Set list of optionnal app to install
|
|
|
|
optionnal_apps_list=""
|
|
|
|
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Configuring options and language..."
|
|
|
|
|
2018-02-06 14:33:23 +01:00
|
|
|
if [[ $whups_install == 1 ]]
|
|
|
|
then
|
|
|
|
optionnal_apps_list="$optionnal_apps_list horde/whups"
|
|
|
|
fi
|
|
|
|
if [[ $sesha_install == 1 ]]
|
|
|
|
then
|
|
|
|
optionnal_apps_list="$optionnal_apps_list horde/sesha"
|
|
|
|
fi
|
|
|
|
# if [[ $ansel_install == 1 ]]
|
|
|
|
# then
|
|
|
|
# optionnal_apps_list="$optionnal_apps_list horde/ansel"
|
|
|
|
# fi
|
|
|
|
if [[ $wicked_install == 1 ]]
|
|
|
|
then
|
|
|
|
optionnal_apps_list="$optionnal_apps_list horde/wicked"
|
|
|
|
fi
|
|
|
|
|
2018-02-11 00:32:26 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-06 14:33:23 +01:00
|
|
|
# Enable all necessary locales
|
|
|
|
if [[ "$language" != "en" ]]
|
|
|
|
then
|
|
|
|
locale_lang=$(egrep -i "(${language})_\1\.UTF-8" /etc/locale.gen | egrep -o "[a-z]{2}_[A-Z]{2}\.UTF-8")
|
2018-11-29 14:59:47 +01:00
|
|
|
for l in $locale_lang; do
|
|
|
|
ynh_replace_string "^#\s$l" "$l" /etc/locale.gen
|
|
|
|
done
|
2018-02-06 14:33:23 +01:00
|
|
|
locale-gen
|
|
|
|
fi
|
|
|
|
|
2022-03-09 00:27:32 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2022-08-31 00:06:07 +02:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
2018-02-06 14:33:23 +01:00
|
|
|
|
2022-03-09 00:27:32 +01:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-11-02 22:33:38 +01:00
|
|
|
mkdir $install_dir/data
|
2022-03-09 00:27:32 +01:00
|
|
|
|
2023-11-02 22:33:38 +01:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2022-03-09 00:27:32 +01:00
|
|
|
|
|
|
|
#=================================================
|
2023-11-02 23:18:22 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2022-03-09 00:27:32 +01:00
|
|
|
#=================================================
|
2023-11-02 23:18:22 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2022-03-09 00:27:32 +01:00
|
|
|
|
2022-08-31 00:06:07 +02:00
|
|
|
# Create a dedicated PHP-FPM config
|
|
|
|
ynh_add_fpm_config
|
2022-03-09 00:27:32 +01:00
|
|
|
|
2022-08-31 00:06:07 +02:00
|
|
|
# Create a dedicated NGINX config
|
|
|
|
config_nginx
|
2022-03-09 00:27:32 +01:00
|
|
|
|
|
|
|
#=================================================
|
2022-08-31 00:06:07 +02:00
|
|
|
# INSTALL SOURCE FILES
|
2022-03-09 00:27:32 +01:00
|
|
|
#=================================================
|
2022-08-31 00:06:07 +02:00
|
|
|
ynh_script_progression --message="Installing sources files..." --weight=7
|
|
|
|
|
2022-03-09 00:27:32 +01:00
|
|
|
# Set execution for expect scripts
|
|
|
|
chmod +x ../conf/init_horde_install.exp
|
|
|
|
chmod +x ../conf/config_horde.exp
|
|
|
|
|
2023-11-02 22:33:38 +01:00
|
|
|
pear config-create "$install_dir" "$install_dir/pear.conf"
|
|
|
|
pear -c "$install_dir/pear.conf" install -o -f pear
|
2018-02-06 14:33:23 +01:00
|
|
|
|
2023-11-02 22:33:38 +01:00
|
|
|
pear_cmd="$install_dir/pear/pear -c $install_dir/pear.conf"
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
$pear_cmd config-set auto_discover 1
|
2023-11-02 22:33:38 +01:00
|
|
|
$pear_cmd config-set data_dir $install_dir/data
|
2018-02-06 14:33:23 +01:00
|
|
|
$pear_cmd channel-discover pear.horde.org
|
|
|
|
|
|
|
|
$pear_cmd install horde/horde_role
|
|
|
|
|
2023-11-02 22:33:38 +01:00
|
|
|
../conf/init_horde_install.exp "$install_dir" "$install_dir/horde"
|
2018-02-06 14:33:23 +01:00
|
|
|
|
2023-11-02 22:33:38 +01:00
|
|
|
$pear_cmd config-set horde_dir "$install_dir/horde"
|
2018-02-06 14:33:23 +01:00
|
|
|
$pear_cmd install -a -B horde/webmail $optionnal_apps_list
|
|
|
|
|
2023-11-02 22:33:38 +01:00
|
|
|
PHP_PEAR_SYSCONF_DIR=$install_dir ../conf/config_horde.exp "$install_dir" "$db_name" "$db_user" "$db_pwd" "$admin"
|
|
|
|
secret_key=$(grep 'secret_key' "$install_dir/horde/config/conf.php" | cut -d"'" -f4)
|
2022-03-09 00:27:32 +01:00
|
|
|
ynh_app_setting_set --app=$app --key=secret_key --value="$secret_key"
|
2018-02-06 14:33:23 +01:00
|
|
|
|
2022-08-31 00:06:07 +02:00
|
|
|
#=================================================
|
|
|
|
# PATCH APPLICATION
|
|
|
|
#=================================================
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Patching application..." --weight=7
|
2022-08-31 00:06:07 +02:00
|
|
|
|
2018-02-06 14:33:23 +01:00
|
|
|
patch_app
|
|
|
|
|
2022-08-31 00:06:07 +02:00
|
|
|
#=================================================
|
|
|
|
# CONFIGURE HORDE
|
|
|
|
#=================================================
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Configuring application..." --weight=3
|
2022-08-31 00:06:07 +02:00
|
|
|
|
2018-02-06 14:33:23 +01:00
|
|
|
config_horde
|
|
|
|
|
2022-08-31 00:06:07 +02:00
|
|
|
#=================================================
|
2022-03-09 00:27:32 +01:00
|
|
|
# SECURE FILES AND DIRECTORIES
|
2022-08-31 00:06:07 +02:00
|
|
|
#=================================================
|
2023-11-02 23:21:54 +01:00
|
|
|
ynh_script_progression --message="Protecting directory..." --weight=1
|
2022-08-31 00:06:07 +02:00
|
|
|
|
2022-03-09 00:27:32 +01:00
|
|
|
set_permission
|
2018-02-06 14:33:23 +01:00
|
|
|
|
2018-02-11 00:32:26 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
2022-03-09 00:27:32 +01:00
|
|
|
# SETUP LOGROTATE
|
|
|
|
#=================================================
|
2022-08-31 00:06:07 +02:00
|
|
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
2018-02-11 00:32:26 +01:00
|
|
|
|
2023-11-02 22:33:38 +01:00
|
|
|
ynh_use_logrotate --logfile="$install_dir/horde" --nonappend --specific_user www-data/horde
|
|
|
|
ynh_use_logrotate --logfile="$install_dir/horde/services" --specific_user www-data/horde
|
|
|
|
ynh_use_logrotate --logfile="$install_dir/horde/services/portal" --specific_user www-data/horde
|
2018-02-06 14:33:23 +01:00
|
|
|
|
2022-03-09 00:27:32 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2019-11-02 21:19:47 +01:00
|
|
|
|
2022-08-31 00:06:07 +02:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|