All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] dracut: install ld.so.conf* with dracut_install instead of cp
@ 2011-03-16 20:24 Amadeusz Żołnowski
       [not found] ` <1300307070-10087-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Amadeusz Żołnowski @ 2011-03-16 20:24 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Amadeusz Żołnowski

---
 dracut |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dracut b/dracut
index 2ae7f8c..4d50472 100755
--- a/dracut
+++ b/dracut
@@ -494,7 +494,7 @@ done
 unset item
 
 # make sure that library links are correct and up to date
-cp -ar /etc/ld.so.conf* "$initdir"/etc
+dracut_install /etc/ld.so.conf /etc/ld.so.conf.d/*
 ldconfig -r "$initdir" || [[ $UID != "0" ]] && \
     dinfo "ldconfig might need uid=0 (root) for chroot()"
 
-- 
1.7.4.1

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

* [PATCH 2/3] dracut-logger: make $maxloglvl public
       [not found] ` <1300307070-10087-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
@ 2011-03-16 20:24   ` Amadeusz Żołnowski
       [not found]     ` <1300307070-10087-2-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
  2011-03-16 20:46   ` [PATCH 1/3] dracut: install ld.so.conf* with dracut_install instead of cp Harald Hoyer
  1 sibling, 1 reply; 4+ messages in thread
From: Amadeusz Żołnowski @ 2011-03-16 20:24 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Amadeusz Żołnowski

$maxloglvl might be useful to check, if expensive informational
operation is going to be logged at all, before executing it.
---
 dracut-logger |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/dracut-logger b/dracut-logger
index 0978d58..830ce1c 100755
--- a/dracut-logger
+++ b/dracut-logger
@@ -76,9 +76,9 @@ __DRACUT_LOGGER__=1
 #   - @var kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
 #   - @var logfile - log file which is used when @var fileloglvl is higher
 #   than 0
-# and one global internal variable @var _maxloglvl which <b>must not</b> be
-# overwritten. @_maxloglvl is set by dlog_init() and holds maximum logging level
-# of those three and indicates that dlog_init() was run.
+# and one global variable @var maxloglvl which <b>must not</b> be overwritten.
+# @var maxloglvl is set by dlog_init() and holds maximum logging level of those
+# three and indicates that dlog_init() was run.
 #
 # Logging level set by the variable means that messages from this logging level
 # and above (FATAL is the highest) will be shown. Logging levels may be set
@@ -101,11 +101,11 @@ __DRACUT_LOGGER__=1
 #   - @var kmsgloglvl = 0 (no logging)
 #   set to 0
 #
-# @warning Function sets global variable @var _maxloglvl for internal use. Don't
-# overwrite it.
+# @warning Function sets global variable @var maxloglvl. See file doc for
+# details.
 dlog_init() {
     # Skip initialization if it's already done.
-    [ -n "$_maxloglvl" ] && return 0
+    [ -n "$maxloglvl" ] && return 0
 
     local ret=0; local errmsg
 
@@ -144,12 +144,12 @@ dlog_init() {
         fi
     fi
 
-    local lvl
-    _maxloglvl=0
-    for lvl in $stdloglvl $sysloglvl $fileloglvl; do
-        [ $lvl -gt $_maxloglvl ] && _maxloglvl=$lvl
+    local lvl; local maxloglvl_l=0
+    for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
+        [ $lvl -gt $maxloglvl_l ] && maxloglvl_l=$lvl
     done
-    export _maxloglvl
+    readonly maxloglvl=$maxloglvl_l
+    export maxloglvl
 
     [ -n "$errmsg" ] && derror "$errmsg"
 
@@ -251,11 +251,11 @@ _dlvl2klvl() {
 #   - @c INFO to @c info
 #   - @c DEBUG and @c TRACE both to @c debug
 _do_dlog() {
-    [ -z "$_maxloglvl" ] && return 0
+    [ -z "$maxloglvl" ] && return 0
     local lvl="$1"; shift
     local lvlc=$(_lvl2char "$lvl") || return 0
 
-    [ $lvl -le $_maxloglvl ] || return 0
+    [ $lvl -le $maxloglvl ] || return 0
 
     local msg="$lvlc: $*"
 
-- 
1.7.4.1

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

* [PATCH 3/3] dracut: script adjusted to new logging facility; -v changed
       [not found]     ` <1300307070-10087-2-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
@ 2011-03-16 20:24       ` Amadeusz Żołnowski
  0 siblings, 0 replies; 4+ messages in thread
From: Amadeusz Żołnowski @ 2011-03-16 20:24 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Amadeusz Żołnowski

-v meaning has changed. Now it increases verbosity level. -q option has
been added, which decreases verbosity level. Both options might be
specified multiple times.
---
 dracut |   64 +++++++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/dracut b/dracut
index 4d50472..882007e 100755
--- a/dracut
+++ b/dracut
@@ -67,8 +67,8 @@ Creates initial ramdisk images for preloading modules
                          4 - info (default)
                          5 - debug info (here starts lots of output)
                          6 - trace info (and even more)
-  -v, --verbose         Verbose output during the build process (info level)
-  -q, --quiet           Display only errors and fatal errors during build
+  -v, --verbose         Increase verbosity level (default is info(4))
+  -q, --quiet           Decrease verbosity level (default is info(4))
   -c, --conf [FILE]     Specify configuration file to use.
                          Default: /etc/dracut.conf
   --confdir [DIR]       Specify configuration directory to use *.conf files 
@@ -179,7 +179,7 @@ push_arg() {
 }
 
 kernel="unset"
-stdloglvl_l=0
+verbosity_mod_l=0
 
 while (($# > 0)); do
     case ${1%%=*} in
@@ -205,8 +205,8 @@ while (($# > 0)); do
         --lvmconf)     lvmconf_l="yes";;
         --nolvmconf)   lvmconf_l="no";;
         --debug)       debug="yes";;
-        -v|--verbose)  beverbose="yes";;
-        -q|--quiet)    bequiet="yes";;
+        -v|--verbose)  ((verbosity_mod_l++));;
+        -q|--quiet)    ((verbosity_mod_l--));;
         -l|--local)    allowlocal="yes" ;;
         -H|--hostonly) hostonly_l="yes" ;;
         --fstab)       use_fstab_l="yes" ;;
@@ -249,12 +249,6 @@ export PATH
     set -x
 }
 
-# For compatibility with -v behaviour. Set to info level.
-[[ $beverbose ]] && (( $stdloglvl_l < 4 )) && stdloglvl_l=4
-
-# When quiet, display only errors and fatal errors.
-[[ $bequiet ]] && (( $stdloglvl_l > 2 )) && stdloglvl_l=2
-
 [[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
 
 [[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
@@ -331,6 +325,10 @@ if [[ ${#fw_dir_l[@]} ]]; then
 fi
 
 [[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
+stdloglvl=$((stdloglvl + verbosity_mod_l))
+((stdloglvl > 6)) && stdloglvl=6
+((stdloglvl < 0)) && stdloglvl=0
+
 [[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
 [[ $do_strip_l ]] && do_strip=$do_strip_l
 [[ $hostonly_l ]] && hostonly=$hostonly_l
@@ -359,7 +357,7 @@ fi
 dracutfunctions=$dracutbasedir/dracut-functions
 export dracutfunctions
 
-dinfo "Executing $0 $dracut_args"
+ddebug "Executing $0 $dracut_args"
 
 [[ $do_list = yes ]] && {
     for mod in $dracutbasedir/modules.d/*; do
@@ -375,12 +373,13 @@ dinfo "Executing $0 $dracut_args"
 [[ $libdir ]] || for libdir in /lib64 /lib; do
     [[ -d $libdir ]] && break
 done || {
-    derror 'No lib directory?!!!'
+    dfatal 'No lib directory?!!!'
     exit 1
 }
+
 [[ $usrlibdir ]] || for usrlibdir in /usr/lib64 /usr/lib; do
     [[ -d $usrlibdir ]] && break
-done || dwarning 'No usr/lib directory!'
+done || dwarn 'No usr/lib directory!'
 
 # This is kinda legacy -- eventually it should go away.
 case $dracutmodules in
@@ -392,7 +391,7 @@ abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
 srcmods="/lib/modules/$kernel/"
 [[ $drivers_dir ]] && {
     if vercmp $(modprobe --version | cut -d' ' -f3) lt 3.7; then
-        derror 'To use --kmoddir option module-init-tools >= 3.7 is required.'
+        dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
         exit 1
     fi
     srcmods="$drivers_dir"
@@ -400,19 +399,19 @@ srcmods="/lib/modules/$kernel/"
 export srcmods
 
 if [[ -f $outfile && ! $force ]]; then
-    derror "Will not override existing initramfs ($outfile) without --force"
+    dfatal "Will not override existing initramfs ($outfile) without --force"
     exit 1
 fi
 
 outdir=${outfile%/*}
 if [[ ! -d "$outdir" ]]; then
-    derror "Can't write $outfile: Directory $outdir does not exist."
+    dfatal "Can't write $outfile: Directory $outdir does not exist."
     exit 1
 elif [[ ! -w "$outdir" ]]; then
-    derror "No permission to write $outdir."
+    dfatal "No permission to write $outdir."
     exit 1
 elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
-    derror "No permission to write $outfile."
+    dfatal "No permission to write $outfile."
     exit 1
 fi
 
@@ -452,7 +451,7 @@ check_module_dir
 for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
     mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
     if strstr "$mods_to_load" " $mod "; then
-        dinfo "*** Sourcing module $mod"
+        dinfo "*** Including module: $mod ***"
         if [[ $kernel_only = yes ]]; then
             module_installkernel $mod
         else
@@ -465,13 +464,14 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
     fi
 done
 unset moddir
+dinfo "*** Including modules' done ***"
 
 ## final stuff that has to happen
 
 # generate module dependencies for the initrd
 if [[ -d $initdir/lib/modules/$kernel ]] && \
     ! depmod -a -b "$initdir" $kernel; then
-    derror "\"depmod -a $kernel\" failed."
+    dfatal "\"depmod -a $kernel\" failed."
     exit 1
 fi
 
@@ -480,6 +480,7 @@ while pop include_src src && pop include_target tgt; do
         if [[ -f $src ]]; then
             inst $src $tgt
         else
+            ddebug "Including directory: $src"
             mkdir -p "${initdir}/${tgt}"
             cp -a -t "${initdir}/${tgt}" "$src"/*
         fi
@@ -495,10 +496,18 @@ unset item
 
 # make sure that library links are correct and up to date
 dracut_install /etc/ld.so.conf /etc/ld.so.conf.d/*
-ldconfig -r "$initdir" || [[ $UID != "0" ]] && \
-    dinfo "ldconfig might need uid=0 (root) for chroot()"
+if ! ldconfig -r "$initdir"; then
+    if [[ $UID = 0 ]]; then
+        derror "ldconfig exited ungracefully"
+    else
+        derror "ldconfig might need uid=0 (root) for chroot()"
+    fi
+fi
 
-[[ $beverbose = yes ]] && (du -c "$initdir" | sort -n)
+if (($maxloglvl >= 5)); then
+    ddebug "Listing sizes of included files:"
+    du -c "$initdir" | sort -n | ddebug
+fi
 
 # strip binaries 
 if [[ $do_strip = yes ]] ; then
@@ -525,10 +534,11 @@ type hardlink &>/dev/null && {
 
 if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
     $compress > "$outfile"; ); then 
-    derror "dracut: creation of $outfile failed"
+    dfatal "dracut: creation of $outfile failed"
     exit 1
 fi 
-dinfo "Wrote $outfile"
-dinfo $(ls -l "$outfile")
+
+dinfo "Wrote $outfile:"
+dinfo "$(ls -l "$outfile")"
 
 exit 0
-- 
1.7.4.1

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

* Re: [PATCH 1/3] dracut: install ld.so.conf* with dracut_install instead of cp
       [not found] ` <1300307070-10087-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
  2011-03-16 20:24   ` [PATCH 2/3] dracut-logger: make $maxloglvl public Amadeusz Żołnowski
@ 2011-03-16 20:46   ` Harald Hoyer
  1 sibling, 0 replies; 4+ messages in thread
From: Harald Hoyer @ 2011-03-16 20:46 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

Am 16.03.2011 21:24, schrieb Amadeusz Żołnowski:
> ---
>  dracut |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/dracut b/dracut
> index 2ae7f8c..4d50472 100755
> --- a/dracut
> +++ b/dracut
> @@ -494,7 +494,7 @@ done
>  unset item
>  
>  # make sure that library links are correct and up to date
> -cp -ar /etc/ld.so.conf* "$initdir"/etc
> +dracut_install /etc/ld.so.conf /etc/ld.so.conf.d/*
>  ldconfig -r "$initdir" || [[ $UID != "0" ]] && \
>      dinfo "ldconfig might need uid=0 (root) for chroot()"
>  


pushed all three

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

end of thread, other threads:[~2011-03-16 20:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-16 20:24 [PATCH 1/3] dracut: install ld.so.conf* with dracut_install instead of cp Amadeusz Żołnowski
     [not found] ` <1300307070-10087-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
2011-03-16 20:24   ` [PATCH 2/3] dracut-logger: make $maxloglvl public Amadeusz Żołnowski
     [not found]     ` <1300307070-10087-2-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
2011-03-16 20:24       ` [PATCH 3/3] dracut: script adjusted to new logging facility; -v changed Amadeusz Żołnowski
2011-03-16 20:46   ` [PATCH 1/3] dracut: install ld.so.conf* with dracut_install instead of cp Harald Hoyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.