-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.py
44 lines (34 loc) · 1.05 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
import os
import sys
def runner_create():
file = open("/usr/local/bin/iha089ftp",'w')
file.write("#!/bin/bash")
file.write("\n")
file.write("python3 /usr/share/ihaahi/iha089ftp/start.py")
file.close()
os.system("chmod +x /usr/local/bin/iha089ftp")
print("type `iha089ftp` to start this script\n")
def iha089_dir():
dir_path = "/usr/share/ihaahi"
if not os.path.exists(dir_path) and os.path.isdir(dir_path):
os.mkdir("/usr/share/ihaahi")
def check_root():
return os.geteuid() == 0
def get_working_dir():
return os.getcwd()
def main():
if sys.platform.startswith("linux"):
if check_root():
iha089_dir()
pwd = get_working_dir()
cmd = "cp -r {} /usr/share/ihaahi".format(pwd)
os.system(cmd)
runner_create()
else:
print("Please run with root permission\n")
elif sys.platform.startswith("win"):
print("Comming soon....\n")
else:
print("Your os not support\n")
if __name__=="__main__":
main()