[rhel7-branch 2/8] livemedia-creator: Copy fsimage if hardlink fails (#1144140)

Brian C. Lane bcl at redhat.com
Tue Sep 23 00:28:37 UTC 2014


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.

(cherry picked from commit b3e80b75641f5f357ace0a6fa6d2e80802514960)

Related: rhbz#1144140
---
 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 b9f815a..6301d4c 100755
--- a/src/sbin/livemedia-creator
+++ b/src/sbin/livemedia-creator
@@ -665,8 +665,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"))
-- 
1.9.3



More information about the anaconda-patches mailing list