1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/horde_ynh.git synced 2024-09-03 19:16:08 +02:00
horde_ynh/scripts/_common.sh

76 lines
2.7 KiB
Bash
Raw Permalink Normal View History

2018-02-06 14:33:23 +01:00
#!/bin/bash
2018-02-11 00:32:26 +01:00
#=================================================
2022-08-31 00:06:07 +02:00
# COMMON VARIABLES
#=================================================
# PHP APP SPECIFIC
2018-02-11 00:32:26 +01:00
#=================================================
#=================================================
2022-08-31 00:06:07 +02:00
# PERSONAL HELPERS
2018-02-11 00:32:26 +01:00
#=================================================
2018-02-06 14:33:23 +01:00
patch_app() {
local old_dir=$(pwd)
2023-11-02 22:33:38 +01:00
(cd "$install_dir/horde" && patch -p1 < $YNH_CWD/../sources/sso_auth.patch) || echo "Unable to apply patches"
2018-02-06 14:33:23 +01:00
cd $old_dir
}
config_horde() {
2023-11-02 23:11:03 +01:00
ynh_add_config --template="horde_conf.php" --destination="$install_dir/horde/config/conf.php"
2023-11-02 22:54:40 +01:00
ynh_add_config --template="/horde_imp_conf.php" --destination="$install_dir/horde/imp/config/conf.php"
ynh_add_config --template="horde_registry.php" --destination="$install_dir/horde/config/registry.local.php"
ynh_add_config --template="gollem_backends.php" --destination="$install_dir/horde/gollem/config/backends.local.php"
ynh_add_config --template="ingo_backends.php" --destination="$install_dir/horde/ingo/config/backends.local.php"
2018-02-06 14:33:23 +01:00
}
config_nginx() {
ynh_add_nginx_config
[[ $service_autodiscovery ]] && add_nginx_autodiscovery
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf"
2018-02-06 14:33:23 +01:00
}
add_nginx_autodiscovery() {
nginx_domain_path=/etc/nginx/conf.d/$domain.d/*
nginx_config_path="/etc/nginx/conf.d/$domain.d/$app.conf"
grep "/Microsoft-Server-ActiveSync" $nginx_domain_path || echo "location /Microsoft-Server-ActiveSync {
2023-11-02 22:33:38 +01:00
return 301 https://\$server_name$path/rpc.php;
2018-02-06 14:33:23 +01:00
}
" >> "$nginx_config_path"
grep "/autodiscover/autodiscover.xml" $nginx_domain_path || echo "location /autodiscover/autodiscover.xml {
2023-11-02 22:33:38 +01:00
return 301 https://\$server_name$path/rpc.php;
2018-02-06 14:33:23 +01:00
}
" >> "$nginx_config_path"
grep "/Autodiscover/Autodiscover.xml" $nginx_domain_path || echo "location /Autodiscover/Autodiscover.xml {
2023-11-02 22:33:38 +01:00
return 301 https://\$server_name$path/rpc.php;
2018-02-06 14:33:23 +01:00
}
" >> "$nginx_config_path"
grep "/.well-known/caldav" $nginx_domain_path || echo "location /.well-known/caldav {
2023-11-02 22:33:38 +01:00
return 301 https://\$server_name$path/rpc.php;
2018-02-06 14:33:23 +01:00
}
" >> "$nginx_config_path"
grep "/.well-known/carddav" $nginx_domain_path || echo "location /.well-known/carddav {
2023-11-02 22:33:38 +01:00
return 301 https://\$server_name$path/rpc.php;
2018-02-06 14:33:23 +01:00
}
" >> "$nginx_config_path"
}
set_permission() {
2023-11-02 22:33:38 +01:00
chown -R www-data:$app $install_dir
2023-11-02 22:54:40 +01:00
chown -R www-data:$app $data_dir
2023-11-02 22:33:38 +01:00
chmod u=rwX,g=rwX,o= -R $install_dir
2023-11-02 22:54:40 +01:00
chmod u=rwX,g=rwX,o= -R $data_dir
2019-05-14 21:46:30 +02:00
}
2022-08-31 00:06:07 +02:00
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================