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]

 



On Tue, 2009-04-07 at 14:45 -1000, 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)"
>  

When I extract the contents of the latest anaconda initrd, and run file
against /sbin, dbus-daemon uses shared-libs but is not executable. 

file dbus-daemon 
dbus-daemon: ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), stripped

This is not the only one:

file * | grep ELF | grep "shared object"
arping:          ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped
dbus-daemon:     ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), stripped
dhcp6c:          ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped
mount:           ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped
mount.cifs:      ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped
mount.nfs:       ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped
mount.nfs4:      ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped
umount:          ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped
umount.cifs:     ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped
umount.nfs:      ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped
umount.nfs4:     ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18,
stripped

That excludes the above from having their libs picked up and included in
the initrd. 

Jerry 

> -    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