Few fixes

This commit is contained in:
Kload 2013-12-09 19:44:10 +01:00
parent 4fcc1642d6
commit e6afa54b49
2 changed files with 9 additions and 2 deletions

View file

@ -818,6 +818,9 @@ hook:
help: Action folder to store into
file:
help: Script to check
-n:
full: --name
help: Destination name for the script
### hook_callback()
callback:

View file

@ -31,19 +31,23 @@ from yunohost import YunoHostError, YunoHostLDAP, win_msg, colorize
hook_folder = '/usr/share/yunohost/hooks/'
def hook_add(action, file):
def hook_add(action, file, name=None):
"""
Store hook script to filsystem
Keyword argument:
file -- Script to add
action -- Action folder to store into
name -- Destination name
"""
try: os.listdir(hook_folder + action)
except OSError: os.makedirs(hook_folder + action)
os.system('cp '+ file +' '+ hook_folder + action)
if name is None:
name = ''
os.system('cp '+ file +' '+ hook_folder + action +'/'+ name)
def hook_callback(action, args=None):