fix(img-lib): ignored null byte in input

The system currently throws numerous nasty warning messages during
the boot, about ignored null bytes in input.

This patch adds a filter to the dd command, to filter these null
bytes out, and thus to prevent these warning messages.

Signed-off-by: Lev Veyde <lveyde@redhat.com>
master
Lev Veyde 2021-04-22 01:11:55 +03:00 committed by Harald Hoyer
parent 782ac8f1f6
commit 85eb96802c
2 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@ det_archive() {
xz="$(/bin/echo -e '\xfd7zXZ')"
gz="$(/bin/echo -e '\x1f\x8b')"
zs="$(/bin/echo -e '\x28\xB5\x2F\xFD')"
headerblock="$(dd ${1:+if=$1} bs=262 count=1 2> /dev/null)"
headerblock="$(dd ${1:+if=$1} bs=262 count=1 2> /dev/null | tr -d '\0')"
case "$headerblock" in
$xz*) echo "xz" ;;
$gz*) echo "gzip" ;;

View File

@ -3,7 +3,7 @@

# called by dracut
check() {
require_binaries tar gzip dd echo || return 1
require_binaries tar gzip dd echo tr || return 1
return 255
}

@ -14,7 +14,7 @@ depends() {

# called by dracut
install() {
inst_multiple tar gzip dd echo
inst_multiple tar gzip dd echo tr
# TODO: make this conditional on a cmdline flag / config option
inst_multiple -o cpio xz bzip2 zstd
inst_simple "$moddir/img-lib.sh" "/lib/img-lib.sh"