From e6afa54b491c4c618a56b26dc5c8a5d43e8763fc Mon Sep 17 00:00:00 2001 From: Kload Date: Mon, 9 Dec 2013 19:44:10 +0100 Subject: [PATCH] Few fixes --- action_map.yml | 3 +++ yunohost_hook.py | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/action_map.yml b/action_map.yml index 68eb4ef4..8295a8ae 100644 --- a/action_map.yml +++ b/action_map.yml @@ -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: diff --git a/yunohost_hook.py b/yunohost_hook.py index 87c2c1ff..781dc535 100644 --- a/yunohost_hook.py +++ b/yunohost_hook.py @@ -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):