mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
helpers2.1: ynh_exec_as $app -> ynh_exec_as_app (with -E option in sudo)
This commit is contained in:
parent
fca26ead78
commit
b4b420d694
1 changed files with 5 additions and 7 deletions
|
@ -172,13 +172,11 @@ ynh_system_user_delete() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute a command as another user
|
# Execute a command after sudoing as $app
|
||||||
#
|
#
|
||||||
# usage: ynh_exec_as $USER COMMAND [ARG ...]
|
# Note that exported bash env variables are kept (using -E option of sudo)
|
||||||
#
|
#
|
||||||
# Requires YunoHost version 4.1.7 or higher.
|
# usage: ynh_exec_as_app COMMAND [ARG ...]
|
||||||
ynh_exec_as() {
|
ynh_exec_as_app() {
|
||||||
local user=$1
|
sudo -E -u"$app" "$@"
|
||||||
shift 1
|
|
||||||
sudo -u "$user" "$@"
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue