public inbox for initramfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dracut-functions.sh: move early mkdir code to dracut.sh
@ 2015-06-25  2:08 Dave Young
       [not found] ` <20150625020802.GA20085-0VdLhd/A9PkMZ+PoPUf8/x/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Young @ 2015-06-25  2:08 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

Move early mkdir code to dracut.sh so that dracut-fuctions.sh can
be used by other components.

For example Fedora kdump mkdumprd uses several functions which were
copied from dracut-functions.sh, with this patch applied dracut-functions.sh
contains only functions so that we can remove the duplicate code in kdump.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 dracut-functions.sh |   11 -----------
 dracut.sh           |   11 +++++++++++
 2 files changed, 11 insertions(+), 11 deletions(-)

Index: dracut/dracut-functions.sh
===================================================================
--- dracut.orig/dracut-functions.sh
+++ dracut/dracut-functions.sh
@@ -19,17 +19,6 @@
 #
 export LC_MESSAGES=C
 
-if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
-    if ! [[ -d "$initdir/.kernelmodseen" ]]; then
-        mkdir -p "$initdir/.kernelmodseen"
-    fi
-    DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
-fi
-
-if [[ $initdir ]] && ! [[ -d $initdir ]]; then
-    mkdir -p "$initdir"
-fi
-
 # Generic substring function.  If $2 is in $1, return 0.
 strstr() { [[ $1 = *"$2"* ]]; }
 # Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
Index: dracut/dracut.sh
===================================================================
--- dracut.orig/dracut.sh
+++ dracut/dracut.sh
@@ -917,6 +917,17 @@ if [[ -f $dracutbasedir/dracut-version.s
     . $dracutbasedir/dracut-version.sh
 fi
 
+if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
+    if ! [[ -d "$initdir/.kernelmodseen" ]]; then
+        mkdir -p "$initdir/.kernelmodseen"
+    fi
+    DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
+fi
+
+if [[ $initdir ]] && ! [[ -d $initdir ]]; then
+    mkdir -p "$initdir"
+fi
+
 if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
     . $dracutbasedir/dracut-functions.sh
 else

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dracut-functions.sh: move early mkdir code to dracut.sh
       [not found] ` <20150625020802.GA20085-0VdLhd/A9PkMZ+PoPUf8/x/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
@ 2015-06-30  1:53   ` Dave Young
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Young @ 2015-06-30  1:53 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

On 06/25/15 at 10:08am, Dave Young wrote:
> Move early mkdir code to dracut.sh so that dracut-fuctions.sh can
> be used by other components.
> 
> For example Fedora kdump mkdumprd uses several functions which were
> copied from dracut-functions.sh, with this patch applied dracut-functions.sh
> contains only functions so that we can remove the duplicate code in kdump.
> 
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  dracut-functions.sh |   11 -----------
>  dracut.sh           |   11 +++++++++++
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 
> Index: dracut/dracut-functions.sh
> ===================================================================
> --- dracut.orig/dracut-functions.sh
> +++ dracut/dracut-functions.sh
> @@ -19,17 +19,6 @@
>  #
>  export LC_MESSAGES=C
>  
> -if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
> -    if ! [[ -d "$initdir/.kernelmodseen" ]]; then
> -        mkdir -p "$initdir/.kernelmodseen"
> -    fi
> -    DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
> -fi
> -
> -if [[ $initdir ]] && ! [[ -d $initdir ]]; then
> -    mkdir -p "$initdir"
> -fi
> -

self NACK, will repost and export DRACUT_KERNEL_LAZY_HASHDIR earlier
Also I need reuse push/pop functions in multipath module so I will repost
another patch series later.

Thanks
Dave

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-30  1:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-25  2:08 [PATCH] dracut-functions.sh: move early mkdir code to dracut.sh Dave Young
     [not found] ` <20150625020802.GA20085-0VdLhd/A9PkMZ+PoPUf8/x/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2015-06-30  1:53   ` Dave Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox