-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
executable file
·36 lines (29 loc) · 1022 Bytes
/
setup.py
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
import os
import shutil
KTOOL_DIR = '/usr/share/ktool'
BIN_DIR = '/usr/local/bin'
def install_ktool():
try:
print('[+] Removing existing ktool directory at {}...'.format(KTOOL_DIR))
shutil.rmtree(KTOOL_DIR)
except FileNotFoundError:
pass # If the directory doesn't exist, continue
except Exception as e:
print('[-] Error removing existing ktool directory:', e)
return
try:
print('[+] Installing ktool to {}...'.format(KTOOL_DIR))
shutil.copytree('.', KTOOL_DIR)
except Exception as e:
print('[-] Error installing ktool:', e)
return
try:
with open(os.path.join(BIN_DIR, 'ktool'), 'w') as f:
f.write('#!/bin/sh\n')
f.write('python3 {} "$@"\n'.format(os.path.join(KTOOL_DIR, 'src', 'ktool.py')))
os.chmod(os.path.join(BIN_DIR, 'ktool'), 0o755)
except Exception as e:
print('[-] Error :', e)
return
print('[+] Ktool installed successfully!')
install_ktool()