|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import uuid
import os
from runcmd import runProcess
def mount(device):
mountID = str(uuid.uuid4())
os.mkdir("/mnt/" + mountID)
output, code = runProcess(["mount","-o","ro",device,"/mnt/" + mountID])
if code != 0:
raise Exception("Unable to mount " + device)
return mountID
def umount(mountID):
output, code = runProcess(["umount","/mnt/" + mountID])
if code != 0:
raise Exception("Unable to umount " + mountID)
os.rmdir("/mnt/" + mountID)
|