[PATCH 1/2] livemedia-creator: Copy fsimage if hardlink fails
Vratislav Podzimek
vpodzime at redhat.com
Mon Apr 28 08:26:56 UTC 2014
On Fri, 2014-04-25 at 11:10 -0700, Brian C. Lane wrote:
> If the user supplies a fsimage to use for the iso it may not be on the
> same filesystem as the working directory. Try to hardlink first, but if
> that fails copy the image.
> ---
> src/sbin/livemedia-creator | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator
> index 61edc8a..75198f0 100755
> --- a/src/sbin/livemedia-creator
> +++ b/src/sbin/livemedia-creator
> @@ -701,8 +701,11 @@ def make_squashfs(disk_img, work_dir, compression="xz"):
> liveos_dir = joinpaths(work_dir, "runtime/LiveOS")
> os.makedirs(liveos_dir)
> os.makedirs(os.path.dirname(joinpaths(work_dir, RUNTIME)))
> - execWithRedirect("/bin/ln", [disk_img,
> - joinpaths(liveos_dir, "rootfs.img")])
> +
> + rc = execWithRedirect("/bin/ln", [disk_img, joinpaths(liveos_dir, "rootfs.img")])
> + if rc != 0:
> + shutil.copy2(disk_img, joinpaths(liveos_dir, "rootfs.img"))
> +
> mksquashfs(joinpaths(work_dir, "runtime"),
> joinpaths(work_dir, RUNTIME), compression)
> remove(joinpaths(work_dir, "runtime"))
These both look good to me.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list