From 330a6fb9a72a54f7b5636e1659dfd5d56177ed0d Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 25 Sep 2017 21:59:55 +0200 Subject: [PATCH] Add and use ynh_get_debian_release --- data/helpers.d/backend | 3 +-- data/helpers.d/system | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/data/helpers.d/backend b/data/helpers.d/backend index e64b67795..60c9c94de 100644 --- a/data/helpers.d/backend +++ b/data/helpers.d/backend @@ -154,12 +154,11 @@ ynh_remove_nginx_config () { # # usage: ynh_add_fpm_config ynh_add_fpm_config () { - local debian_release=$(lsb_release --codename --short) # Configure PHP-FPM 7.0 by default local fpm_config_dir="/etc/php/7.0/fpm" local fpm_service="php7.0-fpm" # Configure PHP-FPM 5 on Debian Jessie - if [ "$debian_release" == "jessie" ]; then + if [ "$(ynh_get_debian_release)" == "jessie" ]; then fpm_config_dir="/etc/php5/fpm" fpm_service="php5-fpm" fi diff --git a/data/helpers.d/system b/data/helpers.d/system index 5f2ad385b..d70129c9a 100644 --- a/data/helpers.d/system +++ b/data/helpers.d/system @@ -41,3 +41,10 @@ ynh_abort_if_errors () { set -eu # Exit if a command fail, and if a variable is used unset. trap ynh_exit_properly EXIT # Capturing exit signals on shell script } + +# Return the Debian release codename (i.e. jessie, stretch, etc.) +# +# usage: ynh_get_debian_release +ynh_get_debian_release () { + echo $(lsb_release --codename --short) +} \ No newline at end of file