[unpackfs] Enable to use "/" as a source
If we don't have/need an image for the rootfs, we might want to configure the `/` directory as a source for unpackfs. Unfortunately, this raises an error: - unpackfs first creates a temporary directory - it then creates a subdirectory for each source, using the source path's basename - when the source is `/`, the basename is an empty string, therefore the module tries to create an already existing directory In order to prevent this error, we use the `os.makedirs` function with parameter `exist_ok=True` instead of `os.mkdir`. Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This commit is contained in:
parent
d422c782ba
commit
0f6b2dbe2d
@ -208,7 +208,7 @@ class UnpackOperation:
|
|||||||
imgbasename = os.path.splitext(
|
imgbasename = os.path.splitext(
|
||||||
os.path.basename(entry.source))[0]
|
os.path.basename(entry.source))[0]
|
||||||
imgmountdir = os.path.join(source_mount_path, imgbasename)
|
imgmountdir = os.path.join(source_mount_path, imgbasename)
|
||||||
os.mkdir(imgmountdir)
|
os.makedirs(imgmountdir, exist_ok=True)
|
||||||
|
|
||||||
self.mount_image(entry, imgmountdir)
|
self.mount_image(entry, imgmountdir)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user