Re: [PATCH 21/31] Some dracut cleanups and bashification.

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

 



On Sun, Feb 08, 2009 at 04:36:15PM -0800, Victor Lowther wrote:
> Simplified get_dso_deps
> 
> This takes advantage of several bash specific constructs to make
> get_dso_deps easier to read and understand.
> ---
>  dracut-functions |   85 +++++++++++++++++------------------------------------
>  1 files changed, 27 insertions(+), 58 deletions(-)
> 
> diff --git a/dracut-functions b/dracut-functions
> index 26254a4..d7717d8 100755
> --- a/dracut-functions
> +++ b/dracut-functions
> @@ -21,73 +21,42 @@
>  #       Peter Jones <pjones@xxxxxxxxxx>
>  #       Jeremy Katz <katzj@xxxxxxxxxx>
>  #       Jakub Jelinek <jakub@xxxxxxxxxx>
> -#
> -#
>  
>  IF_RTLD=""
>  IF_dynamic=""
>  get_dso_deps() {
>      local bin="$1" ; shift
> +    local FILES=() LDSO NAME IO FILE ADDR I1 n f TLIBDIR
>  
> -    declare -a FILES
> -    declare -a NAMES
> -
> -    local LDSO=$(LANG=C eu-readelf -l $bin 2>/dev/null  |grep interpreter |awk {'print $4;'} |sed -e 's/]$//')
> -    [ -z "$LDSO" -o "$LDSO" == "$bin" ] && local LDSO="$IF_RTLD"
> -    [ -z "$LDSO" -o "$LDSO" == "$bin" ] && return 1
> -    [ -z "$IF_RTLD" ] && IF_RTLD="$LDSO"
> +    LDSO=$(LANG=C eu-readelf -l $bin 2>/dev/null | \
> +	awk '/interpreter/ {print $4}' |sed -e 's/]$//')

    awk '/interpreter/ { sub(/]$/,"",$4); print $4 }'

> +    [[ $LDSO && $LDSO != $bin ]] || LDSO="$IF_RTLD"
> +    [[ $LDSO && $LDSO != $bin ]] || return 1
> +    [[ $IF_RTLD ]] || IF_RTLD="$LDSO"

   IF_RTLD=${IF_RTLD:-"$LDSO"}

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux