-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.py
61 lines (49 loc) · 1.96 KB
/
install.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/python3
import os,sys,shutil
if (os.getuid() != 0):
print("ERROR: Please run as root user.")
sys.exit(1)
# Step 1 - Checking Command
#os.system("apt update")
requests_command = ["less","git","wget","unzip","pipx","fzf"]
for check_command in requests_command:
runcode = os.WEXITSTATUS(os.system("command -v %s > /dev/null" % (check_command)))
if (runcode != 0):
while(True):
inputIn = input("ERROR: %s not found on your system, Install it ? (y/n) " % (check_command)).strip().lower()
if (inputIn == "y") or (inputIn == "yes"):
command = "apt install -y %s " % check_command
print("> %s" % command)
os.system(command)
break
if (inputIn == "n") or (inputIn == "no"):
sys.exit(1)
# Step 2 - Install Library
os.system("pip3 install -r requirements.txt")
# Step 3 - Copying the base
if (os.path.exists("/etc/mkt.conf")):
os.remove("/etc/mkt.conf")
shutil.copy("mkt.conf","/etc/mkt.conf")
if (os.path.exists("/var/lib/mkt")):
os.system("rm -rf /var/lib/mkt")
os.system("mkdir -p /var/lib/mkt")
os.system("cp -r . /var/lib/mkt")
# Setp 4 - Testing case
print("[Test] Testing Document Server ...")
os.system("python3 /var/lib/mkt/Test/TestDocServer.py")
# Setp 5 - Setup the env
os.system("chmod -R 755 /var/lib/mkt/")
os.system("ln -s /var/lib/mkt/Tools/Source /Tools")
os.system("ln -s /var/lib/mkt/mkt /bin/mkt")
os.system("ln -s /var/lib/mkt/mkt-update /bin/mkt-update")
os.system("mkdir -p /var/lib/mkt/Res/Data")
os.system("mkdir -p /var/lib/mkt/Res/Install")
os.system("mkdir -p /var/lib/mkt/Tools/Install")
os.system("mkdir -p /var/lib/mkt/Tools/Version")
print("""OK!
======================== Note ========================
All the tools will be install in /var/lib/mkt/Tools/Source/
Config will be in /etc/mkt.conf
Soft link will be create: /var/lib/mkt/Tools/Source/ --> /Tools
========================================================
""")