forked from qwertyquerty/ss13rp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.py
47 lines (37 loc) · 1.07 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
import time
import psutil
PROCNAME = "ss13rp.exe"
for proc in psutil.process_iter():
# check whether the process name matches
if proc.name() == PROCNAME:
proc.kill()
try:
import requests
import getpass
USER_NAME = getpass.getuser()
import subprocess
install_path = 'C:\\Users\\'+USER_NAME+'\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\'
print("Installing...\n")
url = "https://github.com/qwertyquerty/ss13rp/raw/master/dist/ss13rp.exe"
response = requests.get(url, stream=True)
handle = open(install_path+"ss13rp.exe", "wb")
dur = 0
for chunk in response.iter_content(chunk_size=512):
if chunk:
dur = dur+1
if dur % 100 == 0:
print("#", end="")
handle.write(chunk)
print("\n")
handle.close()
del chunk
del handle
del response
print("Installed!\n")
print("Starting...\n")
subprocess.Popen("\""+install_path+"ss13rp.exe\"")
print("Started!\n")
time.sleep(1)
except:
print("Error!")
time.sleep(1)