mirror of
https://github.com/YunoHost-Apps/cryptpad_ynh.git
synced 2024-09-03 18:26:14 +02:00
Update _common.sh
This commit is contained in:
parent
377c03e052
commit
a4ba228ab0
1 changed files with 15 additions and 1 deletions
|
@ -16,4 +16,18 @@ nodejs_version="12"
|
|||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
#=================================================
|
||||
|
||||
|
||||
# Execute a command as another user
|
||||
# usage: ynh_exec_as USER COMMAND [ARG ...]
|
||||
ynh_exec_as() {
|
||||
local USER=$1
|
||||
shift 1
|
||||
|
||||
if [[ $USER = $(whoami) ]]; then
|
||||
eval "$@"
|
||||
else
|
||||
sudo -u "$USER" "$@"
|
||||
fi
|
||||
}
|
Loading…
Add table
Reference in a new issue