dracut-logger: 'user' facility for build-time and 'daemon' for boot-time
PATCH 1/9 dracut-logger: 'user' facility for build-time and 'daemon' for boot-time
--- dracut-logger | 66 ++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 42 insertions(+), 24 deletions(-)
dracut-logger +42 -24
@@ -76,9 +76,11 @@ __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 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. +# and two global variables: @var maxloglvl and @var syslogfacility which <b>must +# not</b> be overwritten. Both are set by dlog_init(). @var maxloglvl holds +# maximum logging level of those three and indicates that dlog_init() was run. +# @var syslogfacility is set either to 'user' (when building initramfs) or +# 'daemon' (when booting). # # 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,8 +103,8 @@ __DRACUT_LOGGER__=1 # - @var kmsgloglvl = 0 (no logging) # set to 0 # -# @warning Function sets global variable @var maxloglvl. See file doc for -# details. +# @warning Function sets global variables @var maxloglvl and @syslogfacility. +# See file doc comment for details. dlog_init() { # Skip initialization if it's already done. [ -n "$maxloglvl" ] && return 0
@@ -144,6 +146,15 @@ dlog_init() { fi fi + if [ $sysloglvl -gt 0 -o $kmsgloglvl -gt 0 ]; then + if [ -n "$dracutbasedir" ]; then + readonly syslogfacility=user + else + readonly syslogfacility=daemon + fi + export syslogfacility + fi + local lvl; local maxloglvl_l=0 for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do [ $lvl -gt $maxloglvl_l ] && maxloglvl_l=$lvl
@@ -180,7 +191,8 @@ _lvl2char() { # @retval 1 if @a lvl is out of range. # @retval 0 if @a lvl is correct. # @result Echoes logger priority. -_lvl2syslogpri() { +_lvl2syspri() { + printf $syslogfacility. case "$1" in 1) echo crit;; 2) echo error;;
@@ -192,7 +204,7 @@ _lvl2syslogpri() { esac } -## @brief Converts dracut-logger numeric level to kernel console log level +## @brief Converts dracut-logger numeric level to syslog log level # # @param lvl Numeric logging level in range from 1 to 6. # @retval 1 if @a lvl is out of range.
@@ -202,26 +214,32 @@ _lvl2syslogpri() { # Conversion is done as follows: # # <tt> -# none -> KERN_EMERG (0) -# FATAL(1) -> KERN_ALERT (1) -# none -> KERN_CRIT (2) -# ERROR(2) -> KERN_ERR (3) -# WARN(3) -> KERN_WARNING (4) -# none -> KERN_NOTICE (5) -# INFO(4) -> KERN_INFO (6) -# DEBUG(5) -> KERN_DEBUG (7) +# FATAL(1) -> LOG_EMERG (0) +# none -> LOG_ALERT (1) +# none -> LOG_CRIT (2) +# ERROR(2) -> LOG_ERR (3) +# WARN(3) -> LOG_WARNING (4) +# none -> LOG_NOTICE (5) +# INFO(4) -> LOG_INFO (6) +# DEBUG(5) -> LOG_DEBUG (7) # TRACE(6) / # </tt> -_dlvl2klvl() { +# +# @see /usr/include/sys/syslog.h +_dlvl2syslvl() { + local lvl + case "$1" in - 1) echo 1;; - 2) echo 3;; - 3) echo 4;; - 4) echo 6;; - 5) echo 7;; - 6) echo 7;; + 1) lvl=0;; + 2) lvl=3;; + 3) lvl=4;; + 4) lvl=6;; + 5) lvl=7;; + 6) lvl=7;; *) return 1;; esac + + [ "$syslogfacility" = user ] && echo $((8+$lvl)) || echo $((24+$lvl)) } ## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
@@ -261,13 +279,13 @@ _do_dlog() { [ $lvl -le $stdloglvl ] && echo "$msg" >&2 if [ $lvl -le $sysloglvl ]; then - logger -t "dracut[$$]" -p $(_lvl2syslogpri $lvl) "$msg" + logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg" fi if [ $lvl -le $fileloglvl -a -w "$logfile" -a -f "$logfile" ]; then echo "$msg" >>"$logfile" fi [ $lvl -le $kmsgloglvl ] && \ - echo "<$(_dlvl2klvl $lvl)>dracut[$$] $msg" >/dev/kmsg + echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg } ## @brief Internal helper function for _do_dlog()
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): 1301065012-16356-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org
PATCH 2/9 dracut: when stdloglvl not set defaulted to 0 - should be 4
Removed unnecessary stdloglvl default in dracut.conf.
--- dracut | 1 + dracut.conf | 1 - 2 files changed, 1 insertions(+), 1 deletions(-)
dracut +1 -0
@@ -332,6 +332,7 @@ if (( ${#fw_dir_l[@]} )); then fi [[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l +[[ ! $stdloglvl ]] && stdloglvl=4 stdloglvl=$((stdloglvl + verbosity_mod_l)) ((stdloglvl > 6)) && stdloglvl=6 ((stdloglvl < 0)) && stdloglvl=0
dracut.conf +0 -1
@@ -2,7 +2,6 @@ logfile=/var/log/dracut.log fileloglvl=6 -stdloglvl=3 # Specific list of dracut modules to use #dracutmodules+=""
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): 1301065012-16356-2-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org
PATCH 3/9 dracut-functions: code formatting corrected
--- dracut-functions | 151 ++++++++++++++++++++++++++++------------------------- 1 files changed, 80 insertions(+), 71 deletions(-)
dracut-functions +80 -71
@@ -63,7 +63,7 @@ vercmp() { } is_func() { - [[ $(type -t $1) = "function" ]] + [[ $(type -t $1) = "function" ]] } # Function prints global variables in format name=value line by line.
@@ -112,25 +112,25 @@ get_fs_uuid() ( # finds the major:minor of the block device backing the root filesystem. find_block_device() { local x mpt majmin dev fs misc maj min - if [[ $use_fstab != yes ]]; then + if [[ $use_fstab != yes ]]; then while read x x majmin x mpt x x fs dev misc; do [[ $fs = nfs ]] && { echo $dev; return 0;} [[ $fs = nfs3 ]] && { echo $dev; return 0;} [[ $fs = nfs4 ]] && { echo $dev; return 0;} [[ $fs = btrfs ]] && { - ls -nLl "$dev" | { - read x x x x maj min x; - maj=${maj//,/}; - echo $maj:$min; + ls -nLl "$dev" | { + read x x x x maj min x + maj=${maj//,/} + echo $maj:$min } && return 0 } if [[ $mpt = $1 ]] && [[ ${majmin#0:} = $majmin ]]; then - echo $majmin; + echo $majmin return 0 # we have a winner! fi - done < /proc/self/mountinfo + done < /proc/self/mountinfo fi - # fall back to /etc/fstab + # fall back to /etc/fstab while read dev mpt fs misc; do if [[ $mpt = $1 ]]; then [[ $fs = nfs ]] && { echo $dev; return 0;}
@@ -139,14 +139,15 @@ find_block_device() { [[ $dev != ${dev#UUID=} ]] && dev=/dev/disk/by-uuid/${dev#UUID=} [[ $dev != ${dev#LABEL=} ]] && dev=/dev/disk/by-label/${dev#LABEL=} [[ -b $dev ]] || return 1 # oops, not a block device. - ls -nLl "$dev" | { - read x x x x maj min x; - maj=${maj//,/}; - echo $maj:$min; + ls -nLl "$dev" | { + read x x x x maj min x + maj=${maj//,/} + echo $maj:$min } && return 0 fi done < /etc/fstab - return 1; + + return 1 } find_root_block_device() { find_block_device /; }
@@ -155,24 +156,24 @@ find_root_block_device() { find_block_device /; } # Stop when our helper function returns success # $1 = function to call on every found block device # $2 = block device in major:minor format -check_block_and_slaves() { - local x +check_block_and_slaves() { + local x [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry. "$1" $2 && return check_vol_slaves "$@" && return 0 if [[ -f /sys/dev/block/$2/../dev ]]; then - check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0 + check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0 fi [[ -d /sys/dev/block/$2/slaves ]] || return 1 for x in /sys/dev/block/$2/slaves/*/dev; do [[ -f $x ]] || continue - check_block_and_slaves $1 $(cat "$x") && return 0 + check_block_and_slaves $1 $(cat "$x") && return 0 done return 1 } get_numeric_dev() { - ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min;} + ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min; } } # ugly workaround for the lvm design
@@ -182,17 +183,16 @@ get_numeric_dev() { # but you cannot create the logical volume without the volume group. # And the volume group might be bigger than the devices the LV needs. check_vol_slaves() { - for i in /dev/mapper/*; do + for i in /dev/mapper/*; do lv=$(get_numeric_dev $i) if [[ $lv = $2 ]]; then vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null) # strip space vg=$(echo $vg) if [[ $vg ]]; then - for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null); \ - do - check_block_and_slaves $1 $(get_numeric_dev $pv) \ - && return 0 + for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null) + do + check_block_and_slaves $1 $(get_numeric_dev $pv) && return 0 done fi fi
@@ -221,7 +221,7 @@ inst_dir() { local target=$(readlink "$file") ln -sfn "$target" "${initdir}$file" || return 1 # resolve relative path and recursively install destination - [[ $target == ${target#/} ]] && target=$(dirname "$file")/$target + [[ $target == ${target#/} ]] && target="$(dirname "$file")/$target" inst_dir "$target" else # create directory
@@ -235,7 +235,7 @@ inst_dir() { # Location of the image dir is assumed to be $initdir # We never overwrite the target if it exists. inst_simple() { - local src target + local src target [[ -f $1 ]] || return 1 src=$1 target="${2:-$1}" if ! [[ -d ${initdir}$target ]]; then
@@ -243,10 +243,10 @@ inst_simple() { inst_dir "${target%/*}" fi # install checksum files also - if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then - inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac" + if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then + inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac" fi - dinfo "Installing $src" + dinfo "Installing $src" cp -pfL "$src" "${initdir}$target" }
@@ -272,7 +272,7 @@ rev_lib_symlinks() { [[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}" done - echo ${links} + echo "${links}" } # Same as above, but specialized to handle dynamic libraries.
@@ -282,15 +282,15 @@ inst_library() { local src=$1 dest=${2:-$1} lib reallib symlink [[ -e $initdir$dest ]] && return 0 if [[ -L $src ]]; then - # install checksum files also - if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then + # install checksum files also + if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then inst "${src%/*}/.${src##*/}.hmac" "${dest%/*}/.${dest##*/}.hmac" fi - reallib=$(readlink -f "$src") - lib=${src##*/} - inst_simple "$reallib" "$reallib" - inst_dir "${dest%/*}" - (cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib") + reallib=$(readlink -f "$src") + lib=${src##*/} + inst_simple "$reallib" "$reallib" + inst_dir "${dest%/*}" + (cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib") else inst_simple "$src" "$dest" fi
@@ -357,7 +357,7 @@ inst_binary() { IF_dynamic=yes continue fi - inst_library "$FILE" + inst_library "$FILE" done inst_simple "$bin" "$target" }
@@ -397,14 +397,14 @@ find_rule() { # udev rules always get installed in the same place, so # create a function to install them to make life simpler. -inst_rules() { +inst_rules() { local target=/etc/udev/rules.d rule found inst_dir "/lib/udev/rules.d" inst_dir "$target" - for rule in "$@"; do - found=$(find_rule "$rule") && \ - inst_simple "$found" "$target/${found##*/}" \ + for rule in "$@"; do + found=$(find_rule "$rule") \ + && inst_simple "$found" "$target/${found##*/}" \ || dinfo "Skipping udev rule: $rule" done }
@@ -416,7 +416,7 @@ inst() { 1) ;; 2) [[ ! $initdir && -d $2 ]] && export initdir=$2 [[ $initdir = $2 ]] && set $1;; - 3) [[ -z $initdir ]] && export initdir=$2 + 3) [[ -z $initdir ]] && export initdir=$2 set $1 $3;; *) derror "inst only takes 1 or 2 or 3 arguments" exit 1;;
@@ -436,14 +436,14 @@ inst_hook() { derror "Aborting initrd creation." exit 1 elif ! strstr "$hookdirs" "$1"; then - derror "No such hook type $1. Aborting initrd creation." + derror "No such hook type $1. Aborting initrd creation." exit 1 fi inst_simple "$3" "/${1}/${2}${3##*/}" } dracut_install() { - if [[ $1 = '-o' ]]; then + if [[ $1 = '-o' ]]; then local optional=yes shift fi
@@ -648,9 +648,10 @@ install_kmod_with_fw() { local modname=${1##*/} fwdir found modname=${modname%.ko*} # no need to go further if the module is already installed - [[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] && return 0 - inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" || \ - return $? + [[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \ + && return 0 + inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \ + || return $? for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do found='' for fwdir in $fw_dir; do
@@ -668,20 +669,23 @@ install_kmod_with_fw() { # Do something with all the dependencies of a kernel module. # Note that kernel modules depend on themselves using the technique we use -# $1 = function to call for each dependency we find -# It will be passed the full path to the found kernel module +# $1 = function to call for each dependency we find +# It will be passed the full path to the found kernel module # $2 = module to get dependencies for # rest of args = arguments to modprobe for_each_kmod_dep() { - local func=$1 kmod=$2 cmd modpapth options + local func=$1 kmod=$2 cmd modpapth options shift 2 - modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | ( \ - local found=0; - while read cmd modpath options; do - [[ $cmd = insmod ]] || continue - $func ${modpath} || exit $? + modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | ( + local found=0 + while read cmd modpath options; do + [[ $cmd = insmod ]] || continue + $func ${modpath} || exit $? found=1 - done; [[ $found -eq 0 ]] && exit 1; exit 0;) + done + [[ $found -eq 0 ]] && exit 1 + exit 0 + ) return $? }
@@ -695,16 +699,20 @@ for_each_kmod_dep() { # This function returns the full filenames of modules that match $1 filter_kernel_modules () ( if ! [[ $hostonly ]]; then - filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra" "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz" 2>/dev/null' + filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"' + filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"' + filtercmd+=' 2>/dev/null' else - filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel 2>/dev/null' + filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename ' + filtercmd+='-k $kernel 2>/dev/null' fi for modname in $(eval $filtercmd); do case $modname in *.ko) "$1" "$modname" && echo "$modname";; *.ko.gz) gzip -dc "$modname" > $initdir/$$.ko $1 $initdir/$$.ko && echo "$modname" - rm -f $initdir/$$.ko;; + rm -f $initdir/$$.ko + ;; esac done )
@@ -717,18 +725,19 @@ instmods() { while (($# > 0)); do mod=${1%.ko*} case $mod in - =*) + =*) # This introduces 2 incompatible meanings for =* arguments # to instmods. We need to decide which one to keep. - if [[ $mod = =ata && -f $srcmods/modules.block ]] ; then - instmods $mpargs $(egrep 'ata|ahci' "${srcmods}/modules.block") + if [[ $mod = =ata && -f $srcmods/modules.block ]]; then + instmods $mpargs \ + $(egrep 'ata|ahci' "${srcmods}/modules.block") elif [ -f $srcmods/modules.${mod#=} ]; then instmods $mpargs $(cat ${srcmods}/modules.${mod#=} ) else instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*") fi ;; - --*) + --*) mod=${mod##*/} mpargs+=" $mod";; i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
@@ -738,25 +747,25 @@ instmods() { [[ -f $initdir/$1 ]] && { shift; continue; } # If we are building a host-specific initramfs and this # module is not already loaded, move on to the next one. - [[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules && \ - ! echo $add_drivers | grep -qe "\<${mod}\>" && { - shift; continue; - } + [[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules \ + && ! echo $add_drivers | grep -qe "\<${mod}\>" && { + shift; continue + } # We use '-d' option in modprobe only if modules prefix path # differs from default '/'. This allows us to use Dracut with # old version of modprobe which doesn't have '-d' option. moddirname=${srcmods%%/lib/modules/*} [[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/" - + # ok, load the module, all its dependencies, and any firmware # it may require for_each_kmod_dep install_kmod_with_fw $mod \ --set-version $kernel ${moddirname} ret=$((ret+$?)) ;; - esac + esac shift done return $ret -} +}
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): 1301065012-16356-3-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org
PATCH 4/9 dracut-functions: logging functions adjusted to dracut-logger
--- dracut-functions | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-)
dracut-functions +15 -13
@@ -246,7 +246,7 @@ inst_simple() { if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac" fi - dinfo "Installing $src" + ddebug "Installing $src" cp -pfL "$src" "${initdir}$target" }
@@ -298,7 +298,7 @@ inst_library() { # 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" + ddebug "Creating extra symlink: $symlink" inst_symlink $symlink } done
@@ -333,9 +333,9 @@ inst_binary() { LC_ALL=C ldd $bin 2>/dev/null | while read line; do [[ $line = 'not a dynamic executable' ]] && return 1 if [[ $line =~ not\ found ]]; then - derror "Missing a shared library required by $bin." - derror "Run \"ldd $bin\" to find out what it is." - derror "dracut cannot create an initrd." + dfatal "Missing a shared library required by $bin." + dfatal "Run \"ldd $bin\" to find out what it is." + dfatal "dracut cannot create an initrd." exit 1 fi so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
@@ -418,7 +418,7 @@ inst() { [[ $initdir = $2 ]] && set $1;; 3) [[ -z $initdir ]] && export initdir=$2 set $1 $3;; - *) derror "inst only takes 1 or 2 or 3 arguments" + *) dfatal "inst only takes 1 or 2 or 3 arguments" exit 1;; esac for x in inst_symlink inst_script inst_binary inst_simple; do
@@ -432,11 +432,11 @@ inst() { # All hooks should be POSIX/SuS compliant, they will be sourced by init. inst_hook() { if ! [[ -f $3 ]]; then - derror "Cannot install a hook ($3) that does not exist." - derror "Aborting initrd creation." + dfatal "Cannot install a hook ($3) that does not exist." + dfatal "Aborting initrd creation." exit 1 elif ! strstr "$hookdirs" "$1"; then - derror "No such hook type $1. Aborting initrd creation." + dfatal "No such hook type $1. Aborting initrd creation." exit 1 fi inst_simple "$3" "/${1}/${2}${3##*/}"
@@ -450,9 +450,10 @@ dracut_install() { while (($# > 0)); do if ! inst "$1" ; then if [[ $optional = yes ]]; then - dwarning "Skipping program $1 as it cannot be found and is flagged to be optional" + dwarn "Skipping program $1 as it cannot be found and is" \ + "flagged to be optional" else - derror "Failed to install $1" + dfatal "Failed to install $1" exit 1 fi fi
@@ -638,7 +639,7 @@ check_module_dir() { for mod in $modcheck; do strstr "$mods_to_load" "$mod" && continue strstr "$omit_dracutmodules" "$mod" && continue - dwarning "Dracut module \"$mod\" cannot be found." + derror "Dracut module \"$mod\" cannot be found." done }
@@ -661,7 +662,8 @@ install_kmod_with_fw() { fi done if [[ $found != yes ]]; then - dinfo "Possible missing firmware \"${fw}\" for kernel module \"${mod}.ko\"" + dwarn "Possible missing firmware \"${fw}\" for kernel module" \ + "\"${mod}.ko\"" fi done return 0
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): 1301065012-16356-4-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org
PATCH 5/9 modules.d: logging functions adjusted to dracut-logger
--- modules.d/10i18n/module-setup.sh | 13 +++++++++---- modules.d/40network/module-setup.sh | 5 +++-- modules.d/50gensplash/module-setup.sh | 2 +- modules.d/98syslog/module-setup.sh | 3 ++- modules.d/99base/module-setup.sh | 4 ++-- 5 files changed, 17 insertions(+), 10 deletions(-)
modules.d/10i18n/module-setup.sh +9 -4
@@ -115,12 +115,15 @@ install() { # original redhat-i18n module. Anyway it won't hurt. EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE} - [[ ${KEYMAP} ]] || dwarning 'No KEYMAP.' || return 1 + [[ ${KEYMAP} ]] || { + derror 'No KEYMAP.' + return 1 + } findkeymap ${KEYMAP} for map in ${EXT_KEYMAPS} do - dinfo "Adding extra map: ${map}" + ddebug "Adding extra map: ${map}" findkeymap ${map} done
@@ -183,13 +186,15 @@ install() { done [[ ${kbddir} ]] || { - derror "Directories ${KBDSUBDIRS//,/, } not found. Please inform us about the issue including your OS name and version." + derror "Directories ${KBDSUBDIRS//,/, } not found. Please" \ + "inform us about the issue including your OS name and version." return 1 } [[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \ [[ ! ${hostonly} || ${i18n_vars} ]] || { - dwarning 'Please set up i18n_vars in configuration file.' + derror 'i18n_vars not set! Please set up i18n_vars in ' \ + 'configuration file.' } return 0 }
modules.d/40network/module-setup.sh +3 -2
@@ -7,13 +7,14 @@ check() { for program in ip arping; do if ! type -P $program >/dev/null; then - dwarning "Could not find program \"$program\" required by network." + derror "Could not find program \"$program\" required by network." return 1 fi done for program in dhclient brctl ifenslave tr; do if ! type -P $program >/dev/null; then - dwarning "Could not find program \"$program\" it might be required by network." + dwarn "Could not find program \"$program\" it might be required " \ + "by network." fi done
modules.d/50gensplash/module-setup.sh +1 -1
@@ -24,7 +24,7 @@ install() { ' for line in ${out}; do if [[ ${line} =~ ^Warning ]]; then - dwarning "${line}" + dwarn "${line}" else derror "${line}" (( ret == 0 )) && ret=1
modules.d/98syslog/module-setup.sh +2 -1
@@ -24,7 +24,8 @@ install() { elif type -P syslog-ng >/dev/null; then installs="syslog-ng" else - dwarning "Could not find any syslog binary although the syslogmodule is selected to be installed. Please check." + derror "Could not find any syslog binary although the syslogmodule" \ + "is selected to be installed. Please check." fi if [ -n "$installs" ]; then dracut_install cat
modules.d/99base/module-setup.sh +2 -2
@@ -31,10 +31,10 @@ install() { # Bail out if switch_root does not exist if type -P switch_root >/dev/null; then inst $(type -P switch_root) /sbin/switch_root \ - || derror "Failed to install switch_root" + || dfatal "Failed to install switch_root" else inst "$moddir/switch_root" "/sbin/switch_root" \ - || derror "Failed to install switch_root" + || dfatal "Failed to install switch_root" fi inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh" inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): 1301065012-16356-5-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org
PATCH 6/9 40network: install dhclient, brctl and ifenslave optionally
Warning given by check() function in case if any of those binaries doesn't exist was removed, because it's produces by "dracut_install -o" later.
--- modules.d/40network/module-setup.sh | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
modules.d/40network/module-setup.sh +2 -7
@@ -11,12 +11,6 @@ check() { return 1 fi done - for program in dhclient brctl ifenslave tr; do - if ! type -P $program >/dev/null; then - dwarn "Could not find program \"$program\" it might be required " \ - "by network." - fi - done return 255 }
@@ -48,7 +42,8 @@ installkernel() { } install() { - dracut_install ip dhclient brctl arping ifenslave tr + dracut_install ip arping tr + dracut_install -o dhclient brctl ifenslave inst "$moddir/ifup" "/sbin/ifup" inst "$moddir/netroot" "/sbin/netroot" inst "$moddir/dhclient-script" "/sbin/dhclient-script"
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): 1301065012-16356-6-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org
PATCH 7/9 dracut-logger: /dev/log is socket, not character device
Fixed typo in error message by the way.
--- dracut-logger | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
dracut-logger +2 -2
@@ -137,12 +137,12 @@ dlog_init() { fi if [ $sysloglvl -gt 0 ]; then - if ! [ -c /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null + if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null then # We cannot log to syslog, so turn this facility off. sysloglvl=0 ret=1 - errmsg="No '/dev/log' or 'logger' not included for syslog logging" + errmsg="No '/dev/log' or 'logger' included for syslog logging" fi fi
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): 1301065012-16356-7-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org
PATCH 8/9 dracut: new option: -M, --show-modules - lists modules on build
Module name is printed to standard output before its inclusion.
--- dracut | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
dracut +8 -1
@@ -106,6 +106,8 @@ Creates initial ramdisk images for preloading modules --no-compress Do not compress the generated initramfs. This will override any other compression options. --list-modules List all available dracut modules. + -M, --show-modules Print included module's name to standard output during + build. EOF }
@@ -230,6 +232,9 @@ while (($# > 0)); do --list-modules) do_list="yes"; ;; + -M|--show-modules) + show_modules_l="yes" + ;; -*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;; *) if ! [[ $outfile ]]; then
@@ -347,6 +352,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) [[ $fw_dir ]] || fw_dir=/lib/firmware [[ $do_strip ]] || do_strip=no [[ $compress_l ]] && compress=$compress_l +[[ $show_modules_l ]] && show_modules=$show_modules_l # eliminate IFS hackery when messing with fw_dir fw_dir=${fw_dir//:/ }
@@ -473,7 +479,8 @@ 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 "*** Including module: $mod ***" + [[ $show_modules = yes ]] && echo "$mod" || \ + dinfo "*** Including module: $mod ***" if [[ $kernel_only = yes ]]; then module_installkernel $mod else
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): 1301065012-16356-8-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org
PATCH 9/9 dracut.conf.5.xml, dracut.8.xml: logging options and -M documented
--- dracut.8.xml | 24 +++++++++++++++++++++++- dracut.conf.5.xml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletions(-)
dracut.8.xml +23 -1
@@ -261,7 +261,18 @@ include in the generic initramfs. This parameter can be specified multiple times <option>--verbose</option> </term> <listitem> - <para>verbose output during the build process</para> + <para>increase verbosity level (default is info(4))</para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <option>-q</option> + </term> + <term> + <option>--quiet</option> + </term> + <listitem> + <para>decrease verbosity level (default is info(4))</para> </listitem> </varlistentry> <varlistentry>
@@ -413,6 +424,17 @@ TARGET directory in the final initramfs. If SOURCE is a file, it will be install <para>List all available dracut modules.</para> </listitem> </varlistentry> + <varlistentry> + <term> + <option>-M</option> + </term> + <term> + <option>--show-modules</option> + </term> + <listitem> + <para>Print included module's name to standard output during build.</para> + </listitem> + </varlistentry> </variablelist> </refsect2> </refsect1>
dracut.conf.5.xml +40 -0
@@ -170,6 +170,46 @@ initramfs.</para> <para>Do not install kernel drivers and firmware files (default=no)</para> </listitem> </varlistentry> + <varlistentry> + <term> + <envar>stdloglvl="<replaceable>{0-6}</replaceable>"</envar> + </term> + <listitem> + <para>Set logging to standard error level.</para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <envar>sysloglvl="<replaceable>{0-6}</replaceable>"</envar> + </term> + <listitem> + <para>Set logging to syslog level.</para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <envar>fileloglvl="<replaceable>{0-6}</replaceable>"</envar> + </term> + <listitem> + <para>Set logging to file level.</para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <envar>logfile="<replaceable><file></replaceable>"</envar> + </term> + <listitem> + <para>Path to log file.</para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <envar>show_modules="<replaceable>{yes|no}</replaceable>"</envar> + </term> + <listitem> + <para>Print included module's name to standard output during build.</para> + </listitem> + </varlistentry> </variablelist> </refsect1> <refsect1>
Signature · 1 line
1.7.4.1
Re: [PATCH 6/9] 40network: install dhclient, brctl and ifenslave optionally
In reply to a message not in the archiveQuoted 3 lines · Amadeusz ¯o³nowski
Warning given by
check()function in case if any of those binaries doesn't exist was removed, because it's produces by "dracut_install-o" later.
I'll have to object to this, sorry. The current network implementation does not check if these binaries are there and throws errors if ip=dhcp is provided and no dhclient is available.
Quoted 31 lines
--- modules.d/40network/module-setup.sh | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)modules.d/40network/module-setup.sh +2
-7@@ -11,12 +11,6 @@ check() { return 1 fi done - for program in dhclient brctl ifenslave tr; do - if ! type -P $program>/dev/null; then - dwarn "Could not find program \"$program\" it might be required " \ - "by network." - fi - done return 255 }@@ -48,7 +42,8 @@ installkernel() { } install() { - dracut_install ip dhclient brctl arping ifenslave tr + dracut_install ip arping tr + dracut_install -o dhclient brctl ifenslave inst "$moddir/ifup" "/sbin/ifup" inst "$moddir/netroot" "/sbin/netroot" inst "$moddir/dhclient-script" "/sbin/dhclient-script"
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 6/9] 40network: install dhclient, brctl and ifenslave optionally
Excerpts from Seewer Philippe's message of Fri Mar 25 16:30:40 +0100 2011:
Quoted 3 lines
I'll have to object to this, sorry. The current network implementation does not check if these binaries are there and throws errors if ip=dhcp is provided and no dhclient is available.
dhclient was optional before. You suggest it should be made required, yes?
Signature · 3 lines
Amadeusz Żołnowski PGP key fpr: C700 CEDE 0C18 212E 49DA 4653 F013 4531 E1DB FAB5
Re: [PATCH 6/9] 40network: install dhclient, brctl and ifenslave optionally
Quoted 7 lines · Amadeusz Żołnowski
Excerpts from Seewer Philippe's message of Fri Mar 25 16:30:40 +0100 2011:
Quoted 3 lines
I'll have to object to this, sorry. The current network implementation does not check if these binaries are there and throws errors if ip=dhcp is provided and no dhclient is available.
dhclient was optional before. You suggest it should be made required, yes?
Ok, I see the point. The dwarning in module-setup was/is misleading. I guess I missed that, sorry.
Since there's currently no code that makes any network functionality optional (See modules.d/40network/ifup for example) question is should there be or should all required binaries actually be *required*?
Regards,
Philippe