-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_hooks.py
More file actions
executable file
·41 lines (27 loc) · 936 Bytes
/
install_hooks.py
File metadata and controls
executable file
·41 lines (27 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
import libhookkit
def main():
config = libhookkit.LibHookKitConfiguration()
hooks = config.get_available_hooks("hookkit_config.json")
if len(hooks) == 0:
print 'No hooks defined in "hookkit_config.json"; aborting.'
exit(1)
exit_code = 0
for hook in hooks:
print 'Linking hook: ' + hook
if os.path.isfile(hook) or os.path.islink(hook):
print 'Failed linking ' + hook + '. File already exists.'
exit_code += 1
continue
try:
os.symlink(os.path.join(os.path.dirname(os.path.abspath(__file__)),
'hookkit.py'), hook)
except:
print 'Failed link: ' + hook + '. Verify you have write access.'
exit_code += 1
exit(exit_code)
if __name__ == '__main__':
main()