Merge #434 Replace mount/umount cmds with libguestfs tools
This commit is contained in:
commit
e02ed6c04b
@ -37,6 +37,7 @@ Requires: gettext
|
|||||||
Requires: syslinux
|
Requires: syslinux
|
||||||
Requires: git
|
Requires: git
|
||||||
Requires: python-jsonschema
|
Requires: python-jsonschema
|
||||||
|
Requires: libguestfs-tools-c
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
|
@ -253,7 +253,9 @@ def tweak_buildinstall(src, dst, arch, variant, label, volid, kickstart_file=Non
|
|||||||
if not os.path.isfile(image):
|
if not os.path.isfile(image):
|
||||||
continue
|
continue
|
||||||
mount_tmp_dir = tempfile.mkdtemp(prefix="tweak_buildinstall")
|
mount_tmp_dir = tempfile.mkdtemp(prefix="tweak_buildinstall")
|
||||||
cmd = ["mount", "-o", "loop", image, mount_tmp_dir]
|
# use guestmount to mount the image, which doesn't require root privileges
|
||||||
|
# LIBGUESTFS_BACKEND=direct: running qemu directly without libvirt
|
||||||
|
cmd = ["LIBGUESTFS_BACKEND=direct", "guestmount", "-a", image, "-m", "/dev/sda", mount_tmp_dir]
|
||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
for config in configs:
|
for config in configs:
|
||||||
@ -264,7 +266,7 @@ def tweak_buildinstall(src, dst, arch, variant, label, volid, kickstart_file=Non
|
|||||||
cmd = ["cp", "-v", "--remove-destination", config_path, config_in_image]
|
cmd = ["cp", "-v", "--remove-destination", config_path, config_in_image]
|
||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
cmd = ["umount", mount_tmp_dir]
|
cmd = ["fusermount", "-u", mount_tmp_dir]
|
||||||
run(cmd)
|
run(cmd)
|
||||||
shutil.rmtree(mount_tmp_dir)
|
shutil.rmtree(mount_tmp_dir)
|
||||||
|
|
||||||
|
@ -138,7 +138,9 @@ def create_product_img(compose, arch, variant):
|
|||||||
"dd if=/dev/zero of=%s bs=1k count=5760" % pipes.quote(image),
|
"dd if=/dev/zero of=%s bs=1k count=5760" % pipes.quote(image),
|
||||||
# create file system
|
# create file system
|
||||||
"mke2fs -F %s" % pipes.quote(image),
|
"mke2fs -F %s" % pipes.quote(image),
|
||||||
"mount -o loop %s %s" % (pipes.quote(image), pipes.quote(mount_tmp)),
|
# use guestmount to mount the image, which doesn't require root privileges
|
||||||
|
# LIBGUESTFS_BACKEND=direct: running qemu directly without libvirt
|
||||||
|
"LIBGUESTFS_BACKEND=direct guestmount -a %s -m /dev/sda %s" % (pipes.quote(image), pipes.quote(mount_tmp)),
|
||||||
"mkdir -p %s/run/install/product" % pipes.quote(mount_tmp),
|
"mkdir -p %s/run/install/product" % pipes.quote(mount_tmp),
|
||||||
"cp -rp %s/* %s/run/install/product/" % (pipes.quote(product_tmp), pipes.quote(mount_tmp)),
|
"cp -rp %s/* %s/run/install/product/" % (pipes.quote(product_tmp), pipes.quote(mount_tmp)),
|
||||||
"mkdir -p %s/run/install/product/pyanaconda" % pipes.quote(mount_tmp),
|
"mkdir -p %s/run/install/product/pyanaconda" % pipes.quote(mount_tmp),
|
||||||
@ -148,7 +150,7 @@ def create_product_img(compose, arch, variant):
|
|||||||
"ln -s run/install/product/locale %s" % pipes.quote(mount_tmp),
|
"ln -s run/install/product/locale %s" % pipes.quote(mount_tmp),
|
||||||
# compat symlink: run/install/product/pyanaconda/installclasses -> ../installclasses
|
# compat symlink: run/install/product/pyanaconda/installclasses -> ../installclasses
|
||||||
"ln -s ../installclasses %s/run/install/product/pyanaconda/installclasses" % pipes.quote(mount_tmp),
|
"ln -s ../installclasses %s/run/install/product/pyanaconda/installclasses" % pipes.quote(mount_tmp),
|
||||||
"umount %s" % pipes.quote(mount_tmp),
|
"fusermount -u %s" % pipes.quote(mount_tmp),
|
||||||
# tweak last mount path written in the image
|
# tweak last mount path written in the image
|
||||||
"tune2fs -M /run/install/product %s" % pipes.quote(image),
|
"tune2fs -M /run/install/product %s" % pipes.quote(image),
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user