Made sure the mount target path exists before mounting.
This commit is contained in:
parent
08cf788eaa
commit
05e848ce62
|
|
@ -366,14 +366,16 @@ class Partition():
|
||||||
if not fs:
|
if not fs:
|
||||||
if not self.filesystem: raise DiskError(f'Need to format (or define) the filesystem on {self} before mounting.')
|
if not self.filesystem: raise DiskError(f'Need to format (or define) the filesystem on {self} before mounting.')
|
||||||
fs = self.filesystem
|
fs = self.filesystem
|
||||||
## libc has some issues with loop devices, defaulting back to sys calls
|
|
||||||
# ret = libc.mount(self.path.encode(), target.encode(), fs.encode(), 0, options.encode())
|
pathlib.Path(self.path).mkdir(parents=True, exist_ok=True)
|
||||||
# if ret < 0:
|
|
||||||
# errno = ctypes.get_errno()
|
try:
|
||||||
# raise OSError(errno, f"Error mounting {self.path} ({fs}) on {target} with options '{options}': {os.strerror(errno)}")
|
sys_command(f'/usr/bin/mount {self.path} {target}')
|
||||||
if sys_command(f'/usr/bin/mount {self.path} {target}').exit_code == 0:
|
except SysCallError as err:
|
||||||
self.mountpoint = target
|
raise err
|
||||||
return True
|
|
||||||
|
self.mountpoint = target
|
||||||
|
return True
|
||||||
|
|
||||||
def unmount(self):
|
def unmount(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue