This repository has been archived by the owner on May 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.py
157 lines (149 loc) · 5.68 KB
/
functions.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import os, time, devices
from colorama import Fore
from zipfile import ZipFile
sys=os.name
linpath=os.getcwd()+'/platform-tools/adb'
winpath='./platform-tools/adb.exe'
##functions necessary to make the script work
##clear terminal
def clc():
if sys == 'posix':
os.system('clear')
else:
os.system('cls')
##clean directories/temporalfiles/files
def clean():
options=["y","n"]
if sys == 'posix':
os.system('rm extractme.zip')
else:
os.system('del extractme.zip')
while True:
yesorno=input('Do you want to remove adb? (y/n) ')
yesornocheck=yesorno in options
if len(yesorno) == 0:
print(f"{Fore.RED}Insert something!{Fore.RESET}")
if yesornocheck == False:
print(f"{Fore.RED}Insert some valid option!{Fore.RESET}")
else:
if yesorno != options[0]:
pass
else:
if sys == 'posix':
os.system('rm -r platform-tools/')
pass
else:
os.system('RD platform-tools\ /s ')
pass
yesorno2=input('Do you want to remove zip flashables? (y/n) ')
yesornocheck2=yesorno2 in options
if len(yesorno2) == 0:
print(f"{Fore.RED}Insert something!{Fore.RESET}")
if yesornocheck2 == False:
print(f"{Fore.RED}Insert some valid option!{Fore.RESET}")
else:
if yesorno2 != options[0]:
return
else:
if sys == 'posix':
os.system('rm surya-pe12.zip')
os.system('rm mido-pe11.zip')
os.system('rm begonia-pe12.zip')
os.system('rm miatoll-pe12.zip')
else:
os.system('del surya-pe12.zip')
os.system('del mido-pe11.zip')
os.system('del begonia-pe12.zip')
os.system('del miatoll-pe12.zip')
return
##get what do you want to do
def __init__():
eschema="""
What do you want to do?
1)Install adb and fastboot (win, debian)
2)Install Pixel Experience
"""
options=["1","2"]
print(eschema)
while True:
quehacerunchecked=input(f'{Fore.BLUE}Put here what do you want to do: {Fore.RESET}')
quehacerchecker= quehacerunchecked in options
if len(quehacerunchecked) == 0:
print(f"{Fore.RED}Insert something!{Fore.RESET}")
if quehacerchecker == False:
print(f"{Fore.RED}Insert some valid option!{Fore.RESET}")
else:
return quehacerunchecked
break
##installer of adb and fastboot
def installer():
sis=os.name
options=["y","n"]
print(f"Your os is: {Fore.GREEN}{sis}{Fore.RESET}")
while True:
yesorno=input('Do you want to proceed? (y/n)')
yesornocheck=yesorno in options
if len(yesorno) == 0:
print(f"{Fore.RED}Insert something!{Fore.RESET}")
if yesornocheck == False:
print(f"{Fore.RED}Insert some valid option!{Fore.RESET}")
if yesorno == 'n':
print(Fore.RED+'closing installer...'+Fore.RESET)
return
else:
break
while True:
if sis=="posix":
answer=input('Are you in debian? (y/n)')
answercheck=answer in options
if len(answer) == 0:
print(f"{Fore.RED}Insert something!{Fore.RESET}")
if answercheck == False:
print(f"{Fore.RED}Insert some valid option!{Fore.RESET}")
if answer != options[0]:
print(f"{Fore.RED}closing installer...{Fore.RESET}")
time.sleep(0.5)
return
else:
print('installing adb and fastboot...')
os.system('wget https://dl.google.com/android/repository/platform-tools_r33.0.3-linux.zip -O extractme.zip')
#os.system(
with ZipFile('extractme.zip', 'r') as zip:
zip.extractall()
os.system(f'pkexec chmod +x {linpath}')
print('installed!')
return
else:
print('installing adb and fastboot...')
os.system('powershell wget https://dl.google.com/android/repository/platform-tools-latest-windows.zip -O extractme.zip')
with ZipFile('extractme.zip', 'r') as zip:
zip.extractall()
print(f'{Fore.GREEN}Installed!{Fore.RESET}')
return 1
#installer
def inst():
options=['mido', 'miatoll','begonia','surya']
print(f'{Fore.LIGHTBLACK_EX}This script is only working for 4 dispositives: mido, miatoll, begonia and surya {Fore.RESET}')
device=input("What is the codename of your device?\ninput: ")
checkdevice=device in options
while True:
if len(device)==0:
Fore.RED
print('wrong input')
Fore.RESET
if checkdevice != True:
Fore.RED
print('wrong input')
Fore.RESET
if device==options[0]:
devices.mido()
return
if device==options[1]:
devices.miatoll()
return
if device==options[2]:
devices.begonia()
return
if device==options[3]:
devices.surya()
return