oem: A few more hacks for selecting the right disk

merge-requests/1/head
Matthias Klumpp 7 years ago
parent 0c8635d487
commit 615012a5ed

@ -175,18 +175,18 @@ def pureos_oem_setup():
# exclude partitions # exclude partitions
if '-part' in d: if '-part' in d:
continue continue
# exclude optical disks
if os.path.realpath(d).startswith('/dev/sr'):
continue
# resolve alias links to direct /dev nodes # resolve alias links to direct /dev nodes
# we need the real path, as sometimes udev does create different names # we need the real path, as sometimes udev does create different names
# when running in d-i # when running in d-i
dev_path = os.path.realpath(d) dev_path = os.path.realpath(d)
# exclude optical disks
if dev_path.startswith('/dev/sr'):
continue
disk = DiskPath(id_alias=d, dev_path=dev_path) disk = DiskPath(id_alias=d, dev_path=dev_path)
local_disks_map[dev_path] = disk local_disks_map[dev_path] = disk
break
if not local_disks_map: if not local_disks_map:
logger.error('No hard disk found on this system!') logger.error('No hard disk found on this system!')
@ -201,9 +201,9 @@ def pureos_oem_setup():
primary_disk = local_disks[0] primary_disk = local_disks[0]
for disk in local_disks: for disk in local_disks:
if '_ssd_' in disk.id_alias.lower(): if '_ssd_' in disk.id_alias.lower():
primary_disk = d primary_disk = disk
if 'nvme' in disk.id_alias.lower(): if 'nvme' in disk.id_alias.lower():
primary_disk = d primary_disk = disk
break break
logger.info('Found disks: {}'.format(str([d.id_alias for d in local_disks]))) logger.info('Found disks: {}'.format(str([d.id_alias for d in local_disks])))
@ -216,11 +216,11 @@ def pureos_oem_setup():
libremhdd.partition_primary_disk() libremhdd.partition_primary_disk()
if len(local_disks) > 1: if len(local_disks) > 1:
for dpath in local_disks: for sdisk in local_disks:
if dpath == primary_disk: if sdisk == primary_disk:
continue continue
logger.info('Partitioning secondary disk "{}"...'.format(dpath)) logger.info('Partitioning secondary disk "{}"...'.format(sdisk))
extrahdd = LibremDiskDevice(primary_disk) extrahdd = LibremDiskDevice(sdisk)
extrahdd.wipe() extrahdd.wipe()
extrahdd.partition_secondary_disk() extrahdd.partition_secondary_disk()
@ -271,6 +271,7 @@ def pureos_oem_setup():
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
print('')
print('Do you really want to continue installing the OEM image?') print('Do you really want to continue installing the OEM image?')
run_oem = input('/!\ THIS WILL ERASE THE CONTENTS OF ALL DISKS FOUND IN THIS DEVICE [Y/n]') run_oem = input('/!\ THIS WILL ERASE THE CONTENTS OF ALL DISKS FOUND IN THIS DEVICE [Y/n]')
if run_oem.strip().lower() != 'y' and run_oem.strip(): if run_oem.strip().lower() != 'y' and run_oem.strip():

Loading…
Cancel
Save