Use libcalamares.utils.mount
This commit is contained in:
parent
0946789f9e
commit
9708669ac7
@ -24,20 +24,6 @@ import tempfile
|
|||||||
import libcalamares
|
import libcalamares
|
||||||
|
|
||||||
|
|
||||||
# FIXME: Duplicated between mount and grub
|
|
||||||
def mount(device_path, mount_point, fs=None, options=None):
|
|
||||||
assert device_path
|
|
||||||
assert mount_point
|
|
||||||
if not os.path.exists(mount_point):
|
|
||||||
os.makedirs(mount_point)
|
|
||||||
cmd = ["mount", device_path, mount_point]
|
|
||||||
if fs:
|
|
||||||
cmd += ("-t", fs)
|
|
||||||
if options:
|
|
||||||
cmd += ("-o", options)
|
|
||||||
subprocess.check_call(cmd)
|
|
||||||
|
|
||||||
|
|
||||||
def mount_partitions(root_mount_point, partitions):
|
def mount_partitions(root_mount_point, partitions):
|
||||||
for partition in partitions:
|
for partition in partitions:
|
||||||
if not partition["mountPoint"]:
|
if not partition["mountPoint"]:
|
||||||
@ -45,10 +31,11 @@ def mount_partitions(root_mount_point, partitions):
|
|||||||
# Create mount point with `+` rather than `os.path.join()` because
|
# Create mount point with `+` rather than `os.path.join()` because
|
||||||
# `partition["mountPoint"]` starts with a '/'.
|
# `partition["mountPoint"]` starts with a '/'.
|
||||||
mount_point = root_mount_point + partition["mountPoint"]
|
mount_point = root_mount_point + partition["mountPoint"]
|
||||||
mount(partition["device"], mount_point,
|
libcalamares.utils.mount(
|
||||||
fs=partition.get("fs"),
|
partition["device"], mount_point,
|
||||||
options=partition.get("options")
|
partition.get("fs", ""),
|
||||||
)
|
partition.get("options", "")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
Loading…
Reference in New Issue
Block a user