补充linux支持(未测试)

This commit is contained in:
cxykevin 2024-02-14 12:34:19 +08:00
parent 125cf129ac
commit d02d58b67a
1 changed files with 5 additions and 2 deletions

View File

@ -22,6 +22,8 @@ def find_disk():
ventoy_drives = [] ventoy_drives = []
if platform.system() == 'Linux': if platform.system() == 'Linux':
mount_point = "/mnt/prinjector_mount_point" mount_point = "/mnt/prinjector_mount_point"
print(
"Warning: Linux support is developing.Please umount {mount_point}")
if not os.path.exists(mount_point): if not os.path.exists(mount_point):
os.mkdir(mount_point) os.mkdir(mount_point)
elif len(os.listdir(mount_point)): elif len(os.listdir(mount_point)):
@ -32,7 +34,8 @@ def find_disk():
j: int = 1 j: int = 1
this_disk = f"/dev/sd{chr(i)}{str(j)}" this_disk = f"/dev/sd{chr(i)}{str(j)}"
while os.path.exists(this_disk): while os.path.exists(this_disk):
os.system(f"mount /dev/sd{chr(i)}{str(j)} {mount_point}") os.system(
f"mount /dev/sd{chr(i)}{str(j)} {mount_point} --mkdir")
if os.path.exists(mount_point+"/ventoy/ventoy.json"): if os.path.exists(mount_point+"/ventoy/ventoy.json"):
return mount_point return mount_point
j += 1 j += 1
@ -46,7 +49,7 @@ def find_disk():
k: int = 1 k: int = 1
while os.path.exists(f"/dev/nvme{str(i)}n{str(j)}p{str(k)}"): while os.path.exists(f"/dev/nvme{str(i)}n{str(j)}p{str(k)}"):
os.system( os.system(
f"mount /dev/nvme{str(i)}n{str(j)}p{str(k)} {mount_point}") f"mount /dev/nvme{str(i)}n{str(j)}p{str(k)} {mount_point} --mkdir")
if os.path.exists(mount_point+"/ventoy/ventoy.json"): if os.path.exists(mount_point+"/ventoy/ventoy.json"):
return mount_point return mount_point
k += 1 k += 1