-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_or_uninstall.py
59 lines (40 loc) · 1.48 KB
/
install_or_uninstall.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
#!/usr/bin/python3
from quick_tools.stylors import *
from quick_tools.design import menu
from quick_tools.utils import rsh, sh, cl, reg
cl()
print(f"\n{sb}{cb}Scrcpy:{nn}")
choice = menu("Install", "Uninstall", mask=f" {sb}{cg}{{i}}) {cb}{{p}}{nn}")
if choice == 1:
print(f"{sb}{cg}\nLoading...\n{nn}")
scrcpy = rsh("curl https://github.com/Genymobile/scrcpy/releases/")
scrcpy = reg(scrcpy, "scrcpy v([.\d]+)</a>")
v = menu(*scrcpy, mask=f" {sb}{cg}{{i}}) {cb}v{{p}}{nn}") - 1
scrcpy_link = f"https://github.com/Genymobile/scrcpy/archive/v{scrcpy[v]}.zip"
server_link = f"https://github.com/Genymobile/scrcpy/releases/download/v{scrcpy[v]}/scrcpy-server-v{scrcpy[v]}"
rsh(f"rm -rf *{scrcpy[v]}*")
print(sb, cg)
for link in (scrcpy_link, server_link):
print(link)
sh(f"wget -q --show-progress {link}")
rsh(f"unzip v{scrcpy[v]}.zip")
rsh(f"mv scrcpy-server-v{scrcpy[v]} scrcpy-{scrcpy[v]}/scrcpy-server")
sh(
f"""
cd scrcpy-{scrcpy[v]}
meson build --buildtype release --strip -Db_lto=true -Dprebuilt_server=scrcpy-server
cd build
ninja
sudo ninja install
"""
)
rsh("mkdir ~/.local/share/icons")
rsh("mkdir ~/.local/share/applications")
sh("cp scrcpy-icon.png ~/.local/share/icons")
sh("cp scrcpy.desktop ~/.local/share/applications")
print(f"{sb}{cg}Scrcpy Installed{nn}")
else:
sh(f"sudo rm -rf /usr/local/*/scrcpy*")
sh("rm ~/.local/share/icons/scrcpy-icon.png")
sh("rm ~/.local/share/applications/scrcpy.desktop")
print(f"{sb}{cr}Scrcpy Uninstalled{nn}")