Re: [PATCH 2/4] Preserve symlinks and only collect deps on ELF executables.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks good,

Regards,

Hans



On 04/08/2009 02:45 AM, David Cantrell wrote:
The mount and umount commands will have a bunch of symlinks, so if the
command we are installing is a symlink, preserve it.

Only use -s on install(1) if the command we are installing is an ELF
executable.  Since there's a check for that, use it to fire off
get_dso_deps() for only ELF executables.
---
  scripts/mk-images |   55 +++++++++++++++++++++++++++++++---------------------
  1 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/scripts/mk-images b/scripts/mk-images
index e669a0b..e1b278b 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -354,31 +354,42 @@ instbin() {
      DIR=$3
      DEST=$4

-    install -s -m 755 $ROOT/$BIN $DIR/$DEST
-    get_dso_deps $ROOT "$BIN"
-    local DEPS="$DSO_DEPS"
-    mkdir -p $DIR/$LIBDIR
+    iself="$(file $ROOT/$BIN | grep ELF | grep executable)"

-    for x in $DEPS ; do
-        cp -Lfp $ROOT/$x $DIR/$LIBDIR
-    done
-
-    pushd $DIR/$LIBDIR
-    if [ -f ld-linux.so.2 -a ! -L ld-linux.so.2 ]; then
-        rm -f ld-linux.so.2
-        linker="$(ls -1 ld-*.*.*.so)"
-        if [ -z "$linker" ]; then
-            linker="$(ls -1 ld-*.*.so)"
-        fi
-        found=$(echo $linker | wc -l)
-        if [ $found -ne 1 ]; then
-            echo "Found too many dynamic linkers:">&2
-            echo $linker>&2
-            exit 1
+    if [ -l $ROOT/$BIN ]; then
+        cp -a $ROOT/$BIN $DIR/$DEST
+    else
+        if [ -z "$iself" ]; then
+            install -m 755 $ROOT/$BIN $DIR/$DEST
+        else
+            install -s -m 755 $ROOT/$BIN $DIR/$DEST
+
+            get_dso_deps $ROOT "$BIN"
+            local DEPS="$DSO_DEPS"
+            mkdir -p $DIR/$LIBDIR
+
+            for x in $DEPS ; do
+                cp -Lfp $ROOT/$x $DIR/$LIBDIR
+            done
+
+            pushd $DIR/$LIBDIR
+            if [ -f ld-linux.so.2 -a ! -L ld-linux.so.2 ]; then
+                rm -f ld-linux.so.2
+                linker="$(ls -1 ld-*.*.*.so)"
+                if [ -z "$linker" ]; then
+                    linker="$(ls -1 ld-*.*.so)"
+                fi
+                found=$(echo $linker | wc -l)
+                if [ $found -ne 1 ]; then
+                    echo "Found too many dynamic linkers:">&2
+                    echo $linker>&2
+                    exit 1
+                fi
+                ln -s $linker ld-linux.so.2
+            fi
+            popd
          fi
-        ln -s $linker ld-linux.so.2
      fi
-    popd
  }

  setupShellEnvironment() {

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux