writing better dev names as keys for diezweite
This commit is contained in:
parent
4f9379c4e2
commit
fd836bf578
|
@ -7,9 +7,9 @@ import os
|
||||||
# getting all local partitions plus their uuids
|
# getting all local partitions plus their uuids
|
||||||
def getpartitions():
|
def getpartitions():
|
||||||
uuids = os.listdir("/dev/disk/by-uuid") #folder contains symlinks to the actual disk devices
|
uuids = os.listdir("/dev/disk/by-uuid") #folder contains symlinks to the actual disk devices
|
||||||
parts = {} #initializing empty dictionary for partition labels/names and uuids
|
parts = {} #initializing empty dictionary for partitions and uuids
|
||||||
for uuid in uuids: #write labels/names as keys and uuids as values in the dictionary
|
for uuid in uuids: #write /dev/names as keys and uuids as values in the dictionary
|
||||||
parts[os.readlink("/dev/disk/by-uuid/" + uuid)[6:]] = uuid
|
parts["/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:]] = uuid
|
||||||
return parts #return the dictionary for further useage
|
return parts #return the dictionary for further useage
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue