mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Wim Muskee <wimmuskee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: dracut-026: lsinitrd doesn't work with provided image
Date: Tue, 12 Mar 2013 15:54:24 +0800	[thread overview]
Message-ID: <513EDF30.7090408@redhat.com> (raw)
In-Reply-To: <CAKzfqkfwg_tW70VJbmgKg-Vs3O2DWLX36o0bMZhYvTL9U9QCRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 03/12/2013 02:53 AM, Wim Muskee wrote:
> hi,
> 
> In dracut-026:
> # dracut /boot/initramfs-dracut-x86_64-3.3.8-gentoo 3.3.8-gentoo
> # lsinitrd /boot/initramfs-dracut-x86_64-3.3.8-gentoo
> 
> No <initramfs file> specified and the default image
> '/boot/initramfs-3.2.1-gentoo-r2.img}' cannot be accessed!
> 
> Usage: lsinitrd [-s] [<initramfs file> [<filename>]]
> 
> Looking at the lsinitrd, the provided image seems to be always
> overwritten after it has been set from $1.
> 

The machine-id section should only be run in case without $1 as image name.
Is below fix works for you?

diff --git a/lsinitrd.sh b/lsinitrd.sh
index 7a09423..fe723f7 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -54,23 +54,23 @@ if [[ "$1" ]]; then
         usage
         exit 1
     fi
-fi
-
-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
-
-if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
-    image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 else
-    image="/boot/initramfs-${KERNEL_VERSION}.img}"
-fi
+    [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
 
-if ! [[ -f "$image" ]]; then
-    {
+    if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+        image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    else
+        image="/boot/initramfs-${KERNEL_VERSION}.img}"
+    fi
+
+    if ! [[ -f "$image" ]]; then
+        {
         echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
         echo
-    } >&2
-    usage
-    exit 1
+        } >&2
+        usage
+        exit 1
+    fi
 fi
 
 CAT=zcat

  parent reply	other threads:[~2013-03-12  7:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 18:53 dracut-026: lsinitrd doesn't work with provided image Wim Muskee
     [not found] ` <CAKzfqkfwg_tW70VJbmgKg-Vs3O2DWLX36o0bMZhYvTL9U9QCRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-12  7:54   ` Dave Young [this message]
     [not found]     ` <513EDF30.7090408-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-12 14:35       ` Wim Muskee
     [not found]         ` <CAKzfqkeUkknOwONqZkuZ8c56+5iNLxigLv+K70sSDXuvPaabZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-12 14:59           ` Harald Hoyer
     [not found]             ` <513F42EC.5030800-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-13  1:48               ` [PATCH] Do not override user specified initramfs image name Dave Young
     [not found]                 ` <513FDAF4.9030908-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-13  7:17                   ` Harald Hoyer
     [not found]                     ` <514027FE.9090600-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-13  7:26                       ` Dave Young

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=513EDF30.7090408@redhat.com \
    --to=dyoung-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=wimmuskee-Re5JQEeQqe8AvxtiuMwx3w@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