diff --git a/helpers/apps b/helpers/apps index 1f3fb5430..aafcfa7e2 100644 --- a/helpers/apps +++ b/helpers/apps @@ -159,8 +159,12 @@ ynh_spawn_app_shell() { exit 1 fi + # Load the app's service name, or default to $app + local service=$(ynh_app_setting_get --app=$app --key=service) + [ -z "$service" ] && service=$app; + # Load the Environment variables from the app's service - local env_var=`systemctl show $app.service -p "Environment" --value` + local env_var=`systemctl show $service.service -p "Environment" --value` [ -n "$env_var" ] && export $env_var; export HOME=$install_dir; @@ -173,7 +177,7 @@ ynh_spawn_app_shell() { fi # Source the EnvironmentFiles from the app's service - local env_files=(`systemctl show $app.service -p "EnvironmentFiles" --value`) + local env_files=(`systemctl show $service.service -p "EnvironmentFiles" --value`) if [ ${#env_files[*]} -gt 0 ] then # set -/+a enables and disables new variables being automatically exported. Needed when using `source`. @@ -186,7 +190,7 @@ ynh_spawn_app_shell() { fi # cd into the WorkingDirectory set in the service, or default to the install_dir - local env_dir = $(systemctl show $app.service -p "WorkingDirectory" --value) + local env_dir = $(systemctl show $service.service -p "WorkingDirectory" --value) [ -z $env_dir ] && env_dir=$install_dir; cd $env_dir