From 10d33d57532c214eb362097a7070eecb520794f6 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 24 May 2020 15:16:07 +0200 Subject: [PATCH 1/2] Fix ynh_add_fpm_config with template in restore --- data/helpers.d/php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/helpers.d/php b/data/helpers.d/php index 9b9df64f9..e7b7887c0 100644 --- a/data/helpers.d/php +++ b/data/helpers.d/php @@ -148,8 +148,12 @@ ynh_add_fpm_config () { if [ $use_template -eq 1 ] then - # Usage 1, use the template in ../conf/php-fpm.conf - cp ../conf/php-fpm.conf "$finalphpconf" + # Usage 1, use the template in conf/php-fpm.conf + local phpfpm_path="../conf/php-fpm.conf" + if [ ! -e "$phpfpm_path" ]; then + phpfpm_path="../settings/conf/php-fpm.conf" # Into the restore script, the php-fpm template is not at the same place + fi + cp "$phpfpm_path" "$finalphpconf" ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$finalphpconf" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finalphpconf" ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$finalphpconf" From 94cecf682dbdf8134bbc9a6bc2f2ca9e0a06ed87 Mon Sep 17 00:00:00 2001 From: JimboJoe Date: Thu, 28 May 2020 07:15:46 +0200 Subject: [PATCH 2/2] Update data/helpers.d/php Co-authored-by: Alexandre Aubin --- data/helpers.d/php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/helpers.d/php b/data/helpers.d/php index e7b7887c0..3117be2e6 100644 --- a/data/helpers.d/php +++ b/data/helpers.d/php @@ -153,6 +153,8 @@ ynh_add_fpm_config () { if [ ! -e "$phpfpm_path" ]; then phpfpm_path="../settings/conf/php-fpm.conf" # Into the restore script, the php-fpm template is not at the same place fi + # Make sure now that the template indeed exists + [ -e "$phpfpm_path" ] || ynh_die --message="Unable to find template to configure php-fpm." cp "$phpfpm_path" "$finalphpconf" ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$finalphpconf" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finalphpconf"