Found the problem, it seems that /lib64 is a symlink to /usr/lib64 in
CentOS 7 and this breaks as the --extract-over-symlinks option to cpio
is not used. I'm not sure about how to submit a patch, so I've made a
fix on a clone of the repository as well as attaching a patch: see

https://github.com/ashkulz/rinse/commit/b7fdd330b86fde7a74f280641b653af9f3d5f74e

With the above change, I am successfully able to setup a CentOS-7 chroot.
From b7fdd330b86fde7a74f280641b653af9f3d5f74e Mon Sep 17 00:00:00 2001
From: Ashish Kulkarni <[email protected]>
Date: Sat, 11 Apr 2015 18:23:12 +0530
Subject: [PATCH] fix creation of CentOS-7 chroot (#768501)

This was broken since 5d2767aba4aa5b5c625c312967319b415f79ae03, as the
filesystem package in CentOS-7 has a symlink from /lib64 to /usr/lib64.
When extracting via cpio, this failed with the error:

    cpio: Can't write over symlinks: ./lib64/libaudit.so.1

Using the --extract-over-symlinks option allows successful creation of
the chroot environment. A check was also added to ensure that failure
to extract a package would cause the process to fail.
---
 bin/rinse | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/rinse b/bin/rinse
index 096a57f..2e9579e 100755
--- a/bin/rinse
+++ b/bin/rinse
@@ -1147,13 +1147,13 @@ sub unpackPackages {
       #  Run the unpacking command.
       #
       my $cmd =
-        "rpm2cpio $file | (cd $CONFIG{'directory'} ; cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>/dev/null >/dev/null";
+        "rpm2cpio $file | (cd $CONFIG{'directory'} ; cpio --extract --extract-over-symlinks --make-directories --no-absolute-filenames --preserve-modification-time) 2>/dev/null >/dev/null";
       if ( $file =~ /(fedora|centos|redhat|mandriva)-release-/ ) {
         my $rpmname = basename($file);
         $postcmd =
           "cp $file $CONFIG{'directory'}/tmp ; chroot $CONFIG{'directory'} rpm -ivh --force --nodeps /tmp/$rpmname ; rm $CONFIG{'directory'}/tmp/$rpmname";
       }
-      system($cmd );
+      system($cmd) == 0 or die "failed to extract $name: $?";
 
     }
     print "\r";

Reply via email to