-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
main.py
executable file
·611 lines (489 loc) · 24.1 KB
/
main.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
#!/usr/bin/env python3
# pylint: disable=C0301,C0116,C0103,R0903
"""
This script was created by Coopydood as part of the ultimate-macOS-KVM project.
https://github.com/user/Coopydood
https://github.com/Coopydood/ultimate-macOS-KVM
Signature: 4CD28348A3DD016F
"""
# WELCOME TO ULTMOS! *waves like an idiot*
##################################################
# THIS IS THE MAIN FILE! RUN THIS FILE FIRST! #
# #
# $ ./main.py #
##################################################
import os
import time
import subprocess
import re
import json
import sys
import argparse
import platform
import datetime
sys.path.append('./resources/python')
from cpydColours import color
try:
from pypresence import Presence
except:
None
sys.path.insert(0, 'scripts')
parser = argparse.ArgumentParser("main")
parser.add_argument("--skip-vm-check", dest="svmc", help="Skip the arbitrary VM check",action="store_true")
parser.add_argument("--skip-os-check", dest="sosc", help="Skip the OS platform check",action="store_true")
parser.add_argument("--disable-rpc", dest="rpcDisable", help="Disable Discord Rich Presence integration",action="store_true")
args = parser.parse_args()
global apFilePath
global VALID_FILE
global REQUIRES_SUDO
global discordRPC
global baseSystemNotifArmed
detectChoice = 1
latestOSName = "Sequoia"
latestOSVer = "15"
runs = 0
apFilePath = ""
procFlow = 1
discordRPC = 1
baseSystemNotifArmed = False
version = open("./.version")
version = version.read()
versionDash = version.replace(".","-")
if args.rpcDisable == True:
discordRPC = 0
else:
discordRPC = 1 # DEBUGGG
projectVer = "Powered by ULTMOS v"+version
# We don't need these files anymore. If they're here, get rid
if os.path.exists("./UPGRADEPATH"): os.system("rm ./UPGRADEPATH")
if os.path.exists("./VERSION"): os.system("rm ./VERSION")
if os.path.exists("./resources/WEBVERSION"): os.system("rm ./resources/WEBVERSION")
def startup():
global detectChoice
global apFile
global apFilePath
detectChoice = None
if not os.path.exists("resources/script_store/main.py"): # BACKUP ORIGINAL FILES TO STORE
os.system("cp -R ./scripts/* ./resources/script_store/")
os.system("cp ./main.py ./resources/script_store/")
os.system("cp ./.version ./resources/script_store/")
if isVM == True:
print(color.YELLOW+"\n ⚠ Virtual machine detected, functionality may be limited\n"+color.END)
if os.path.exists("blobs/user/USR_CFG.apb"):
print(color.BOLD+"\n\n "+color.CYAN,"ULTMOS"+color.END+color.GRAY,"v"+version+color.END)
print(" by Coopydood"+color.END)
tainted = 1
else:
print(color.BOLD+"\n\n Welcome to"+color.CYAN,"ULTMOS"+color.END+color.GRAY,"v"+version+color.END)
print(" by Coopydood"+color.END)
print("\n This project can assist you in some often-tedious setup, including\n processes like"+color.BOLD,"checking your GPU, checking your system, downloading macOS,\n "+color.END+"and more. Think of it like your personal KVM swiss army knife.")
#print(color.BOLD+"\n"+"Profile:"+color.END,"https://github.com/Coopydood")
#print(color.BOLD+" Repo:"+color.END,"https://github.com/Coopydood/ultimate-macOS-KVM")
#print(" Select an option to continue.")
if os.path.exists("./blobs/USR_TARGET_OS.apb") and not os.path.exists("./blobs/user/USR_TARGET_OS.apb"): # Rescue live blobs if coming from older repo version
os.system("mv ./blobs/*.apb ./blobs/user")
if os.path.exists("./blobs/user/USR_CFG.apb"):
global apFilePath
global apFilePathNoPT
global apFile
global apFilePathNoUSB
global macOSVer
global mOSString
apFilePath = open("./blobs/user/USR_CFG.apb")
apFilePath = apFilePath.read()
if os.path.exists("./blobs/user/USR_TARGET_OS_NAME.apb"):
macOSVer = open("./blobs/user/USR_TARGET_OS_NAME.apb")
macOSVer = macOSVer.read()
macOSVer = open("./blobs/user/USR_TARGET_OS.apb")
macOSVer = macOSVer.read()
if int(macOSVer) <= 999 and int(macOSVer) > 99:
macOSVer = str(int(macOSVer) / 100)
mOSString = "Mac OS X"
else:
mOSString = "macOS"
if os.path.exists("./blobs/user/USR_TARGET_OS_NAME.apb"):
macOSVer = open("./blobs/user/USR_TARGET_OS_NAME.apb")
macOSVer = macOSVer.read()
if os.path.exists("./"+apFilePath):
global REQUIRES_SUDO
global VALID_FILE
global VALID_FILE_NOPT
global VALID_FILE_NOUSB
global baseSystemNotifArmed
VALID_FILE = 0
VALID_FILE_NOPT = 0
VALID_FILE_NOUSB = 0
apFile = open("./"+apFilePath,"r")
if "REQUIRES_SUDO=1" in apFile.read():
REQUIRES_SUDO = 1
else:
REQUIRES_SUDO = 0
apFile.close()
apFile = open("./"+apFilePath,"r")
apFilePathNoPT = apFilePath.replace(".sh","-noPT.sh")
apFilePathNoUSB = apFilePath.replace(".sh","-noUSB.sh")
apFileM = apFile.read()
if "APC-RUN" in apFileM:
VALID_FILE = 1
if "#-drive id=BaseSystem,if=none,file=\"$REPO_PATH/BaseSystem.img\",format=raw" not in apFileM and "-drive id=BaseSystem,if=none,file=\"$REPO_PATH/BaseSystem.img\",format=raw" in apFileM and "HDD_PATH=\"/dev/disk/" not in apFileM:
if os.path.exists("./blobs/user/USR_HDD_PATH.apb"):
hddPath = open("./blobs/user/USR_HDD_PATH.apb")
hddPath = hddPath.read()
hddPath = hddPath.replace("$REPO_PATH",os.path.realpath(os.curdir))
if (os.path.getsize(hddPath)) > 22177079296 and not os.path.exists("./blobs/user/.noBaseSystemReminder"):
baseSystemNotifArmed = True
#REQUIRES_SUDO = 1 # UNCOMMENT FOR DEBUGGING
if REQUIRES_SUDO == 1:
print(color.BOLD+"\n B. Boot",mOSString,macOSVer+color.YELLOW,"⚠"+color.END)
print(color.END+" Start",mOSString,"using the detected\n "+apFilePath+" script file."+color.YELLOW,"Requires superuser."+color.END)
else:
print(color.BOLD+"\n B. Boot",mOSString,macOSVer+"")
print(color.END+" Start",mOSString,"using the detected\n "+apFilePath+" script file.")
if os.path.exists("./"+apFilePathNoPT):
VALID_FILE_NOPT = 1
if os.path.exists("./"+apFilePathNoUSB):
VALID_FILE_NOUSB = 1
if VALID_FILE_NOPT == 1 or VALID_FILE_NOUSB == 1:
print(color.BOLD+"\n O. Other boot options...")
print(color.END+"\n 1. AutoPilot")
else:
print(color.BOLD+"\n 1. AutoPilot")
print(color.END+" Quickly and easily set up a macOS\n virtual machine in just a few steps\n")
else:
print(color.BOLD+"\n 1. AutoPilot")
print(color.END+" Quickly and easily set up a macOS\n virtual machine in just a few steps\n")
else:
print(color.BOLD+"\n 1. AutoPilot")
print(color.END+" Quickly and easily set up a macOS\n virtual machine in just a few steps\n")
#print(color.END+" 2. Download and convert macOS image")
#print(color.END+" 3. Check GPU compatibility")
#print(color.END+" 4. Check IOMMU grouping")
#print(color.END+" 5. Get and display vfio-pci IDs")
#print(color.END+" 6. Verify devices bound to vfio-pci")
print(color.END+" 2. Download macOS...")
print(color.END+" 3. Compatibility checks...")
print(color.END+" 4. Passthrough tools...\n")
print(color.END+" E. Extras...")
print(color.END+" W. What's new?")
print(color.END+" U. Check for updates")
print(color.END+" Q. Exit\n")
detectChoice = str(input(color.BOLD+"Select> "+color.END))
def clear(): print("\n" * 150)
def baseSystemAlert():
global apFilePath
clear()
print("\n\n "+color.BOLD+color.GREEN+"FINISHED INSTALLING MACOS?"+color.END,"")
print(" Finished install detected\n")
print(" The assistant has detected that your macOS installation \n may be complete. Would you like me to remove the install\n media from your config file for you?\n\n This stops the \"macOS Base System\" boot entry from appearing.\n")
#print(color.YELLOW+color.BOLD+"\n ⚠ "+color.END+color.BOLD+"WARNING"+color.END+"\n This action requires superuser permissions.\n"+color.END)
print(color.BOLD+" 1. Remove BaseSystem"+color.END)
print(color.END+" Detaches the macOS installer\n from the",apFilePath+" file\n")
print(color.END+" 2. Not now")
print(color.END+" 3. Don't remind me again\n")
detectChoice5 = str(input(color.BOLD+"Select> "+color.END))
if detectChoice5 == "1":
with open("./"+apFilePath,"r") as apFile:
apFileM = apFile.read()
apFileM = apFileM.replace("-drive id=BaseSystem,if=none,file=\"$REPO_PATH/BaseSystem.img\",format=raw\n-device ide-hd,bus=sata.4,drive=BaseSystem","#-drive id=BaseSystem,if=none,file=\"$REPO_PATH/BaseSystem.img\",format=raw\n#-device ide-hd,bus=sata.4,drive=BaseSystem")
apFile.close()
time.sleep(1)
with open("./"+apFilePath,"w") as apFile:
apFile.write(apFileM)
apFile.close()
clear()
print("\n\n "+color.BOLD+color.GREEN+"DONE"+color.END,"")
print(" BaseSystem removed successfully\n\n\n\n\n\n\n\n")
time.sleep(3)
clear()
elif detectChoice5 == "3":
with open("./blobs/user/.noBaseSystemReminder","w") as remindFile:
remindFile.write(" ")
remindFile.close()
clear()
else:
clear()
os.system("chmod +x -R scripts/*.py")
os.system("chmod +x -R scripts/extras/*.py")
#os.system("chmod +x -R scripts/extras/*.sh")
os.system("chmod +x -R scripts/restore/*.py")
os.system("chmod +x -R scripts/*.sh")
os.system("chmod +x resources/dmg2img")
os.system("chmod +x scripts/hyperchromiac/*.py")
output_stream = os.popen('lspci')
vmc1 = output_stream.read()
detected = 0
global isVM
isVM = False
if "VMware" in vmc1:
detected = 1
if "VirtualBox" in vmc1 or "Oracle" in vmc1:
detected = 1
if "Redhat" in vmc1 or "RedHat" in vmc1 or "QEMU" in vmc1:
detected = 1
if "Bochs" in vmc1 or "Sea BIOS" in vmc1 or "SeaBIOS" in vmc1:
detected = 1
if platform.system() != "Linux":
detected = 2
clear()
#detected = 2 # FORCE DETECTION OF INCOMPATIBLE OS FOR DEBUG
if detected == 1:
if args.svmc == True:
clear()
startup()
else:
isVM = True
print("\n "+color.BOLD+color.YELLOW+"⚠ VIRTUAL MACHINE DETECTED"+color.END)
print(" Virtualized devices detected")
print("\n I've determined that it's more than likely that \n you're using a virtual machine to run this. I won't\n stop you, but there really isn't much point in continuing."+color.END)
print("\n "+color.BOLD+color.YELLOW+"PROBLEM:",color.END+"Virtual hardware detected"+color.END)
print(color.BOLD+"\n 1. Exit")
print(color.END+" 2. Continue anyway\n")
stageSelect = str(input(color.BOLD+"Select> "+color.END))
if stageSelect == "1":
sys.exit
elif stageSelect == "2":
clear()
startup()
elif detected == 2:
if args.sosc == True:
clear()
startup()
else:
print("\n "+color.BOLD+color.RED+"✖ INCOMPATIBLE OPERATING SYSTEM"+color.END)
print(" "+platform.system()+" detected")
print("\n I've determined that you're using "+platform.system()+". \n Put simply, this project won't work on here.\n To save you further disappointment, I'm instead\n throwing you this error.\n\n Sorry :/"+color.END)
print("\n "+color.BOLD+color.RED+"PROBLEM:",color.END+"well... not Linux... ¯\\_(ツ)_/¯"+color.END)
print("\n\n\n")
time.sleep(5)
sys.exit
else:
clear()
startup()
#baseSystemAlert() # uncomment to always trigger notification
if detectChoice == "1":
os.system('./scripts/autopilot.py')
elif detectChoice == "2":
os.system('./scripts/dlosx.py')
elif detectChoice == "3":
clear()
os.system('./scripts/compatchecks.py')
elif detectChoice == "4":
clear()
os.system('./scripts/vfio-menu.py')
elif detectChoice == "e" or detectChoice == "E":
clear()
os.system('./scripts/extras.py')
elif detectChoice == "w" or detectChoice == "W":
clear()
print("\n\n "+color.BOLD+color.GREEN+"✔ OPENING RELEASE NOTES IN DEFAULT BROWSER"+color.END,"")
print(" Continue in your browser\n")
print("\n I have attempted to open the release notes in\n your default browser. Please be patient.\n\n You will be returned to the main menu in 5 seconds.\n\n\n\n\n")
os.system('xdg-open https://github.com/Coopydood/ultimate-macOS-KVM/blob/main/docs/changelogs/v'+versionDash+".md > /dev/null 2>&1")
time.sleep(6)
clear()
os.system('./main.py')
elif detectChoice == "u" or detectChoice == "U":
clear()
os.system('./scripts/repo-update.py --menuFlow')
elif detectChoice == "b" and VALID_FILE == 1 or detectChoice == "B" and VALID_FILE == 1:
clear()
if not os.path.exists("./ovmf/OVMF_VARS.df"): # AUTO REPAIR OVMF
if os.path.exists("./ovmf/user_store/OVMF_VARS.fd"):
os.system("cp ./ovmf/user_store/OVMF_VARS.fd ./ovmf/OVMF_VARS.fd")
else:
os.system("cp ./resources/ovmf/OVMF_VARS.fd ./ovmf/OVMF_VARS.fd")
if discordRPC == 1:
# Discord rich presence routine
client_id = "1149434759152422922"
try:
RPC = Presence(client_id)
except:
None
if os.path.exists("./blobs/user/USR_VFIO_DEVICES.apb"):
vfioDevs = open("./blobs/user/USR_VFIO_DEVICES.apb")
vfioDevs = vfioDevs.read()
subprocess.Popen(["python3","./scripts/drpc.py","--os",macOSVer,"--pt",vfioDevs])
else:
subprocess.Popen(["python3","./scripts/drpc.py","--os",macOSVer])
if REQUIRES_SUDO == 1:
print(color.YELLOW+color.BOLD+"\n ⚠ "+color.END+color.BOLD+"SUPERUSER PRIVILEGES"+color.END+"\n This script uses physical device passthrough,\n and needs superuser privileges to run.\n\n Press CTRL+C to cancel.\n"+color.END)
if baseSystemNotifArmed == True:
baseSystemAlert()
if discordRPC == 0:
os.system("sudo ./"+apFilePath+" -d 0")
else:
os.system("sudo ./"+apFilePath)
else:
if baseSystemNotifArmed == True:
baseSystemAlert()
if discordRPC == 0:
os.system("./"+apFilePath+" -d 0")
else:
os.system("./"+apFilePath)
elif detectChoice == "o" and VALID_FILE_NOPT == 1 or detectChoice == "o" and VALID_FILE_NOUSB == 1 or detectChoice == "O" and VALID_FILE_NOPT == 1 or detectChoice == "O" and VALID_FILE_NOUSB == 1:
# Spawn boot options menu
clear()
print(color.BOLD+color.BLUE+"\n\n BOOT OPTIONS FOR",mOSString.upper(),macOSVer.upper()+""+color.END)
print(" The following boot options are available:")
if REQUIRES_SUDO == 1:
print(color.BOLD+"\n 1. Boot",mOSString,macOSVer+color.YELLOW,"⚠"+color.END)
print(color.END+" Start",mOSString,"using the detected\n "+apFilePath+" script file."+color.YELLOW,"Requires superuser."+color.END)
else:
print(color.BOLD+"\n 1. Boot",mOSString,macOSVer+"")
print(color.END+" Start",mOSString,"using the detected\n "+apFilePath+" script file.")
if VALID_FILE_NOPT == 1:
apFile = open("./"+apFilePathNoPT,"r")
if "REQUIRES_SUDO=1" in apFile.read():
REQUIRES_SUDO = 1
else:
REQUIRES_SUDO = 0
if REQUIRES_SUDO == 1:
print(color.BOLD+"\n 2. Boot",mOSString,macOSVer+" without PCI passthrough"+color.YELLOW+" ⚠"+color.END)
print(color.END+" Start",mOSString,"using "+apFilePathNoPT+", with\n no passthrough devices enabled."+color.YELLOW,"Requires superuser."+color.END)
else:
print(color.BOLD+"\n 2. Boot",mOSString,macOSVer+" without PCI passthrough")
print(color.END+" Start",mOSString,"using "+apFilePathNoPT+", with\n no passthrough devices enabled.")
if VALID_FILE_NOUSB == 1:
apFile = open("./"+apFilePathNoUSB,"r")
if "REQUIRES_SUDO=1" in apFile.read():
REQUIRES_SUDO = 1
else:
REQUIRES_SUDO = 0
if REQUIRES_SUDO == 1:
print(color.BOLD+"\n 3. Boot",mOSString,macOSVer+" without host USB devices"+color.YELLOW+" ⚠"+color.END)
print(color.END+" Start",mOSString,"using "+apFilePathNoUSB+", with\n no host USB devices."+color.YELLOW,"Requires superuser."+color.END)
else:
print(color.BOLD+"\n 3. Boot",mOSString,macOSVer+" without host USB devices")
print(color.END+" Start",mOSString,"using "+apFilePathNoUSB+", with\n no host USB devices.")
print(color.END+"\n B. Back...")
print(color.END+" Q. Exit\n")
detectChoice3 = str(input(color.BOLD+"Select> "+color.END))
if detectChoice3 == "1" and VALID_FILE == 1: # REGULAR BOOT
clear()
if not os.path.exists("./ovmf/OVMF_VARS.df"): # AUTO REPAIR OVMF
if os.path.exists("./ovmf/user_store/OVMF_VARS.fd"):
os.system("cp ./ovmf/user_store/OVMF_VARS.fd ./ovmf/OVMF_VARS.fd")
else:
os.system("cp ./resources/ovmf/OVMF_VARS.fd ./ovmf/OVMF_VARS.fd")
if discordRPC == 1:
# Discord rich presence routine
client_id = "1149434759152422922"
try:
RPC = Presence(client_id)
except:
None
if os.path.exists("./blobs/user/USR_VFIO_DEVICES.apb"):
vfioDevs = open("./blobs/user/USR_VFIO_DEVICES.apb")
vfioDevs = vfioDevs.read()
subprocess.Popen(["python3","./scripts/drpc.py","--os",macOSVer,"--pt",vfioDevs])
else:
subprocess.Popen(["python3","./scripts/drpc.py","--os",macOSVer])
if REQUIRES_SUDO == 1:
print(color.YELLOW+color.BOLD+"\n ⚠ "+color.END+color.BOLD+"SUPERUSER PRIVILEGES"+color.END+"\n This script uses physical device passthrough,\n and needs superuser privileges to run.\n\n Press CTRL+C to cancel.\n"+color.END)
if baseSystemNotifArmed == True:
baseSystemAlert()
if discordRPC == 0:
os.system("sudo ./"+apFilePath+" -d 0")
else:
os.system("sudo ./"+apFilePath)
else:
if baseSystemNotifArmed == True:
baseSystemAlert()
if discordRPC == 0:
os.system("./"+apFilePath+" -d 0")
else:
os.system("./"+apFilePath)
if detectChoice3 == "2" and VALID_FILE_NOPT == 1: # NO PASSTHROUGH BOOT
clear()
apFile = open("./"+apFilePathNoPT,"r")
if "REQUIRES_SUDO=1" in apFile.read():
REQUIRES_SUDO = 1
else:
REQUIRES_SUDO = 0
if not os.path.exists("./ovmf/OVMF_VARS.df"): # AUTO REPAIR OVMF
if os.path.exists("./ovmf/user_store/OVMF_VARS.fd"):
os.system("cp ./ovmf/user_store/OVMF_VARS.fd ./ovmf/OVMF_VARS.fd")
else:
os.system("cp ./resources/ovmf/OVMF_VARS.fd ./ovmf/OVMF_VARS.fd")
if discordRPC == 1:
# Discord rich presence routine
client_id = "1149434759152422922"
try:
RPC = Presence(client_id)
except:
None
subprocess.Popen(["python3","./scripts/drpc.py","--os",macOSVer])
if REQUIRES_SUDO == 1:
print(color.YELLOW+color.BOLD+"\n ⚠ "+color.END+color.BOLD+"SUPERUSER PRIVILEGES"+color.END+"\n This script uses physical device passthrough,\n and needs superuser privileges to run.\n\n Press CTRL+C to cancel.\n"+color.END)
if baseSystemNotifArmed == True:
baseSystemAlert()
if discordRPC == 0:
os.system("sudo ./"+apFilePathNoPT+" -d 0")
else:
os.system("sudo ./"+apFilePathNoPT)
else:
if baseSystemNotifArmed == True:
baseSystemAlert()
if discordRPC == 0:
os.system("./"+apFilePathNoPT+" -d 0")
else:
os.system("./"+apFilePathNoPT)
if detectChoice3 == "3" and VALID_FILE_NOUSB == 1: # NO USB BOOT
clear()
apFile = open("./"+apFilePathNoUSB,"r")
if "REQUIRES_SUDO=1" in apFile.read():
REQUIRES_SUDO = 1
else:
REQUIRES_SUDO = 0
if not os.path.exists("./ovmf/OVMF_VARS.df"): # AUTO REPAIR OVMF
if os.path.exists("./ovmf/user_store/OVMF_VARS.fd"):
os.system("cp ./ovmf/user_store/OVMF_VARS.fd ./ovmf/OVMF_VARS.fd")
else:
os.system("cp ./resources/ovmf/OVMF_VARS.fd ./ovmf/OVMF_VARS.fd")
if discordRPC == 1:
# Discord rich presence routine
client_id = "1149434759152422922"
try:
RPC = Presence(client_id)
except:
None
subprocess.Popen(["python3","./scripts/drpc.py","--os",macOSVer])
if REQUIRES_SUDO == 1:
print(color.YELLOW+color.BOLD+"\n ⚠ "+color.END+color.BOLD+"SUPERUSER PRIVILEGES"+color.END+"\n This script uses physical device passthrough,\n and needs superuser privileges to run.\n\n Press CTRL+C to cancel.\n"+color.END)
if baseSystemNotifArmed == True:
baseSystemAlert()
if discordRPC == 0:
os.system("sudo ./"+apFilePathNoUSB+" -d 0")
else:
os.system("sudo ./"+apFilePathNoUSB)
else:
if baseSystemNotifArmed == True:
baseSystemAlert()
if discordRPC == 0:
os.system("./"+apFilePathNoUSB+" -d 0")
else:
os.system("./"+apFilePathNoUSB)
elif detectChoice3 == "b" or detectChoice3 == "B":
os.system('./main.py --skip-vm-check')
elif detectChoice3 == "q" or detectChoice3 == "Q":
exit
else:
startup()
elif detectChoice == "q" or detectChoice == "Q":
clear()
print(color.BOLD+"\n\n "+color.PURPLE+"GOODBYE!"+color.END)
print(" Thanks for using ULTMOS!"+color.END)
print("\n This project was created with "+color.RED+color.BOLD+"❤"+color.END+" by Coopydood\n and a growing list of awesome contributors.\n\n Have feedback, issues, or want to contribute?\n I'd love to hear from you!\n\n "+color.BOLD+"https://github.com/Coopydood/ultimate-macOS-KVM\n https://discord.gg/WzWkSsT\n"+color.END)
hr = datetime.datetime.now().time().hour
if hr > 3 and hr < 12:
print(" Have a nice day! :]\n\n\n")
elif hr >= 12 and hr < 17:
print(" Have a nice rest of your afternoon! :]\n\n\n")
elif hr >= 17 and hr < 21:
print(" Have a nice evening! :]\n\n\n")
else:
print(" Have a nice night - "+color.CYAN+"and remember to sleep!"+color.END+" :]\n\n\n")
exit(0)
elif detected != 2:
clear()
os.system('./main.py')