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
}
kernel="unset"
-stdloglvl_l=0
+verbosity_mod_l=0
while (($# > 0)); do
case ${1%%=*} in
--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" ;;
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" ]] && \
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
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
[[ $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
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"
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
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
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
if [[ -f $src ]]; then
inst $src $tgt
else
+ ddebug "Including directory: $src"
mkdir -p "${initdir}/${tgt}"
cp -a -t "${initdir}/${tgt}" "$src"/*
fi
# 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
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