mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Offer apps to set service name for ynh_spawn_app_shell
This commit is contained in:
parent
a47e491869
commit
5fa58f19ce
1 changed files with 7 additions and 3 deletions
10
helpers/apps
10
helpers/apps
|
@ -159,8 +159,12 @@ ynh_spawn_app_shell() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# 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;
|
[ -n "$env_var" ] && export $env_var;
|
||||||
export HOME=$install_dir;
|
export HOME=$install_dir;
|
||||||
|
|
||||||
|
@ -173,7 +177,7 @@ ynh_spawn_app_shell() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Source the EnvironmentFiles from the app's service
|
# 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 ]
|
if [ ${#env_files[*]} -gt 0 ]
|
||||||
then
|
then
|
||||||
# set -/+a enables and disables new variables being automatically exported. Needed when using `source`.
|
# set -/+a enables and disables new variables being automatically exported. Needed when using `source`.
|
||||||
|
@ -186,7 +190,7 @@ ynh_spawn_app_shell() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# cd into the WorkingDirectory set in the service, or default to the install_dir
|
# 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;
|
[ -z $env_dir ] && env_dir=$install_dir;
|
||||||
cd $env_dir
|
cd $env_dir
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue