Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ def get_media_path(device):
def get_partition(device):
os.system("fdisk -l %s > output" % device)
with open("output", "r") as f:
data = f.read()
return data.split("\n")[-2].split()[0].strip()
# make a list of lines which arn't empty
data = [line for line in f.readlines() if line.strip()]
# take the last partition in the fdisk partition table printout.
data = data[-1].split()[0]
return data


def is_mounted(device):
Expand Down