mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] change behavior, admin by default, as to explicitly set root as user
This commit is contained in:
parent
b0730d8463
commit
33e101b588
1 changed files with 4 additions and 4 deletions
|
@ -292,7 +292,7 @@ def hook_callback(action, hooks=[], args=None, no_trace=False, chdir=None,
|
||||||
|
|
||||||
|
|
||||||
def hook_exec(path, args=None, raise_on_error=False, no_trace=False,
|
def hook_exec(path, args=None, raise_on_error=False, no_trace=False,
|
||||||
chdir=None, env=None, user=None):
|
chdir=None, env=None, user="admin"):
|
||||||
"""
|
"""
|
||||||
Execute hook from a file with arguments
|
Execute hook from a file with arguments
|
||||||
|
|
||||||
|
@ -328,10 +328,10 @@ def hook_exec(path, args=None, raise_on_error=False, no_trace=False,
|
||||||
cmd_script = path
|
cmd_script = path
|
||||||
|
|
||||||
# Construct command to execute
|
# Construct command to execute
|
||||||
if user is not None:
|
if user == "root":
|
||||||
command = ['sudo', '-n', '-u', user, '-H', 'sh', '-c']
|
|
||||||
else:
|
|
||||||
command = ['sh', '-c']
|
command = ['sh', '-c']
|
||||||
|
else:
|
||||||
|
command = ['sudo', '-n', '-u', user, '-H', 'sh', '-c']
|
||||||
|
|
||||||
if no_trace:
|
if no_trace:
|
||||||
cmd = '/bin/bash "{script}" {args}'
|
cmd = '/bin/bash "{script}" {args}'
|
||||||
|
|
Loading…
Add table
Reference in a new issue