Add and use ynh_get_debian_release

This commit is contained in:
Jimmy Monin 2017-09-25 21:59:55 +02:00
parent 8590d6b5c6
commit 330a6fb9a7
2 changed files with 8 additions and 2 deletions

View file

@ -154,12 +154,11 @@ ynh_remove_nginx_config () {
# #
# usage: ynh_add_fpm_config # usage: ynh_add_fpm_config
ynh_add_fpm_config () { ynh_add_fpm_config () {
local debian_release=$(lsb_release --codename --short)
# Configure PHP-FPM 7.0 by default # Configure PHP-FPM 7.0 by default
local fpm_config_dir="/etc/php/7.0/fpm" local fpm_config_dir="/etc/php/7.0/fpm"
local fpm_service="php7.0-fpm" local fpm_service="php7.0-fpm"
# Configure PHP-FPM 5 on Debian Jessie # 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_config_dir="/etc/php5/fpm"
fpm_service="php5-fpm" fpm_service="php5-fpm"
fi fi

View file

@ -41,3 +41,10 @@ ynh_abort_if_errors () {
set -eu # Exit if a command fail, and if a variable is used unset. 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 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)
}