mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Amadeusz Żołnowski" <aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] dracut-functions: additional symlinks for library files
Date: Wed, 21 Jul 2010 13:39:57 +0200	[thread overview]
Message-ID: <4C46DC8D.9010308@redhat.com> (raw)
In-Reply-To: <20100707163909.042ddb5e@etiriah>

pushed

On 07/07/2010 04:39 PM, Amadeusz Żołnowski wrote:
> rev_lib_symlinks: it's new
> inst_library: creating additional symlinks for installed library files
> ---
>   dracut-functions |   35 ++++++++++++++++++++++++++++++++++-
>   1 files changed, 34 insertions(+), 1 deletions(-)
>
> diff --git a/dracut-functions b/dracut-functions
> index 1f2528e..b9b4d43 100755
> --- a/dracut-functions
> +++ b/dracut-functions
> @@ -226,11 +226,36 @@ inst_simple() {
>       cp -pfL "$src" "${initdir}$target"
>   }
>
> +# find symlinks linked to given library file
> +# $1 = library file
> +# Function searches for symlinks by stripping version numbers appended to
> +# library filename, checks if it points to the same target and finally
> +# prints the list of symlinks to stdout.
> +#
> +# Example:
> +# rev_lib_symlinks libfoo.so.8.1
> +# output: libfoo.so.8 libfoo.so
> +# (Only if libfoo.so.8 and libfoo.so exists on host system.)
> +rev_lib_symlinks() {
> +    [[ ! $1 ]]&&  return 0
> +
> +    local fn="$1" orig="$(readlink -f "$1")" links=''
> +
> +    [[ ${fn} =~ .*\.so\..* ]] || return 1
> +
> +    until [[ ${fn##*.} == so ]]; do
> +        fn="${fn%.*}"
> +        [[ -L ${fn}&&  $(readlink -f "${fn}") == ${orig} ]]&&  links+=" ${fn}"
> +    done
> +
> +    echo ${links}
> +}
> +
>   # Same as above, but specialized to handle dynamic libraries.
>   # It handles making symlinks according to how the original library
>   # is referenced.
>   inst_library() {
> -    local src=$1 dest=${2:-$1}
> +    local src=$1 dest=${2:-$1} lib reallib symlink
>       [[ -e $initdir$dest ]]&&  return 0
>       if [[ -L $src ]]; then
>   	reallib=$(readlink -f "$src")
> @@ -241,6 +266,14 @@ inst_library() {
>       else
>   	inst_simple "$src" "$dest"
>       fi
> +
> +    # Create additional symlinks.  See rev_symlinks description.
> +    for symlink in $(rev_lib_symlinks $src) $(rev_lib_symlinks $reallib); do
> +        [[ ! -e $initdir$symlink ]]&&  {
> +            dinfo "Creating extra symlink: $symlink"
> +            inst_symlink $symlink
> +        }
> +    done
>   }
>
>   # find a binary.  If we were not passed the full path directly,

      reply	other threads:[~2010-07-21 11:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 14:39 [PATCH] dracut-functions: additional symlinks for library files Amadeusz Żołnowski
2010-07-21 11:39 ` Harald Hoyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C46DC8D.9010308@redhat.com \
    --to=harald-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox