1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snappymail_ynh.git synced 2024-09-03 20:26:29 +02:00

Move everything to $install_dir/app subfolder

This commit is contained in:
Tagada 2023-08-04 15:44:10 +02:00
parent 2533ea63d6
commit 41e713bac0
5 changed files with 29 additions and 18 deletions

View file

@ -315,7 +315,7 @@ mail_func_additional_parameters = Off
folders_spec_limit = 50 folders_spec_limit = 50
curl_proxy = "" curl_proxy = ""
curl_proxy_auth = "" curl_proxy_auth = ""
custom_login_link='__PATH__/sso.php' custom_login_link=''
custom_logout_link='https://__MAIN_DOMAIN__/yunohost/sso/?action=logout' custom_logout_link='https://__MAIN_DOMAIN__/yunohost/sso/?action=logout'
http_client_ip_check_proxy = Off http_client_ip_check_proxy = Off
fast_cache_memcache_host = "127.0.0.1" fast_cache_memcache_host = "127.0.0.1"
@ -333,4 +333,4 @@ dev_password = ""
[version] [version]
current = "2.28.1" current = "2.28.1"
saved = "Wed, 21 Jun 2023 06:38:05 +0000" saved = "Wed, 21 Jun 2023 06:38:05 +0000"

View file

@ -5,7 +5,7 @@ name = "SnappyMail"
description.en = "Simple, modern, lightweight & fast web-based e-mail client" description.en = "Simple, modern, lightweight & fast web-based e-mail client"
description.fr = "Client de messagerie Web simple, moderne, léger et rapide" description.fr = "Client de messagerie Web simple, moderne, léger et rapide"
version = "2.28.4~ynh1" version = "2.28.4~ynh2"
maintainers = ["eric_G"] maintainers = ["eric_G"]

View file

@ -31,7 +31,7 @@ ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
ynh_script_progression --message="Setting up source files..." --weight=3 ynh_script_progression --message="Setting up source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src # 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/app"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
@ -57,20 +57,20 @@ ynh_use_logrotate
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
mkdir -p "$install_dir/data/_data_/_default_/configs" mkdir -p "$install_dir/app/data/_data_/_default_/configs"
chown $app:$app -R "$install_dir/data/_data_" chown $app:$app -R "$install_dir/app/data/_data_"
ynh_add_config --template="application.ini" --destination="$install_dir/data/_data_/_default_/configs/application.ini" ynh_add_config --template="application.ini" --destination="$install_dir/app/data/_data_/_default_/configs/application.ini"
chmod 400 "$install_dir/data/_data_/_default_/configs/application.ini" chmod 400 "$install_dir/app/data/_data_/_default_/configs/application.ini"
chown $app:$app "$install_dir/data/_data_/_default_/configs/application.ini" chown $app:$app "$install_dir/app/data/_data_/_default_/configs/application.ini"
#================================================= #=================================================
# SETUP SSO # SETUP SSO
#================================================= #=================================================
ynh_script_progression --message="Applying SSO patch..." --weight=1 ynh_script_progression --message="Applying SSO patch..." --weight=1
ynh_add_config --template="../sources/sso.php" --destination="$install_dir/sso.php" ynh_add_config --template="../sources/sso.php" --destination="$install_dir/index.php"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -38,6 +38,17 @@ if [ -z "${fpm_usage:-}" ]; then
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi fi
# Do something when upgrading from 2.3.2~ynh1 or lower
if ynh_compare_current_package_version --comparison le --version 2.28.4~ynh1
then
# Move everything inside a $install_dir/app/ subfolder
# This allows to have a $install_dir/index.php handling the SSO
mkdir -p $install_dir/app
# Ugly way to not return an error when moving everything to a subfolter of the same folder https://stackoverflow.com/a/43262922
find $install_dir -maxdepth 1 -mindepth 1 -not -name app -exec mv -t $install_dir/app {} +
chown $app:root $install_dir/app/
fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -47,7 +58,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=5 ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="data/_data_/_default_/configs/application.ini" ynh_setup_source --dest_dir="$install_dir/app" --keep="data/_data_/_default_/configs/application.ini"
fi fi
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
@ -74,17 +85,17 @@ ynh_use_logrotate --non-append
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="application.ini" --destination="$install_dir/data/_data_/_default_/configs/application.ini" ynh_add_config --template="application.ini" --destination="$install_dir/app/data/_data_/_default_/configs/application.ini"
chmod 400 "$install_dir/data/_data_/_default_/configs/application.ini" chmod 400 "$install_dir/app/data/_data_/_default_/configs/application.ini"
chown $app:$app "$install_dir/data/_data_/_default_/configs/application.ini" chown $app:$app "$install_dir/app/data/_data_/_default_/configs/application.ini"
#================================================= #=================================================
# SETUP SSO # SETUP SSO
#================================================= #=================================================
ynh_script_progression --message="Applying SSO patch..." --weight=1 ynh_script_progression --message="Applying SSO patch..." --weight=1
ynh_add_config --template="../sources/sso.php" --destination="$install_dir/sso.php" ynh_add_config --template="../sources/sso.php" --destination="$install_dir/index.php"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -2,7 +2,7 @@
// Enable SnappyMail Api and include index file // Enable SnappyMail Api and include index file
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true; $_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
require 'index.php'; require 'app/index.php';
// Retrieve email and password // Retrieve email and password
if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) { if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) {
@ -10,8 +10,8 @@ if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) {
$password = $_SERVER['PHP_AUTH_PW']; $password = $_SERVER['PHP_AUTH_PW'];
$ssoHash = \RainLoop\Api::CreateUserSsoHash($email, $password); $ssoHash = \RainLoop\Api::CreateUserSsoHash($email, $password);
// redirect to webmail sso url // redirect to webmail sso url
\header('Location: https://__DOMAIN____PATH__/?sso&hash='.$ssoHash); \header('Location: https://__DOMAIN____PATH__/app/?sso&hash='.$ssoHash);
} }
else { else {
\header('Location: https://__DOMAIN____PATH__/snappymail/'); \header('Location: https://__DOMAIN____PATH__/app/');
} }