diff --git a/dracut b/dracut index 109d8e8..1aeb0ad 100755 --- a/dracut +++ b/dracut @@ -21,7 +21,7 @@ Creates initial ramdisk images for preloading modules -d, --drivers [LIST] Specify a space-separated list of kernel modules to include in the initramfs -h, --help This message - -d, --debug Output debug information of the build process + --debug Output debug information of the build process -v, --verbose Verbose output during the build process -c, --conf [FILE] Specify configuration file to use. Default: /etc/dracut.conf @@ -43,7 +43,7 @@ while (($# > 0)); do -m|--modules) dracutmodules_l="$2"; shift;; -d|--drivers) modules_l="$2"; shift;; -h|--help) usage; exit 1 ;; - -d|--debug) set -x;; + --debug) debug="yes"; set -x;; -v|--verbose) beverbose="yes";; -c|--conf) conffile="$2"; shift;; -l|--local) allowlocal="yes" ;; @@ -96,7 +96,7 @@ hookdirs="pre-udev pre-mount pre-pivot mount" readonly initdir=$(mktemp -d -t initramfs.XXXXXX) trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die. -export initdir hookdirs dsrc dracutmodules modules +export initdir hookdirs dsrc dracutmodules modules debug # Create some directory structure first for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot dev/pts; do diff --git a/dracut-functions b/dracut-functions index 6839ba9..106a2d4 100755 --- a/dracut-functions +++ b/dracut-functions @@ -127,6 +127,8 @@ inst_script() { [[ -f $1 ]] || return 1 local line read -r -n 80 line <"$1" + # If debug is set, clean unprintable chars to prevent messing up the term + [[ $debug ]] && line=$(echo -n "$line" | tr -c -d '[:print:][:space:]') [[ $line =~ (#! *)(/[^ ]+).* ]] || return 1 inst "${BASH_REMATCH[2]}" && inst_simple "$@" }