#!/bin/bash set +o posix function inventory_osinitrd_firmware() { pushd $1 2>&1 > /dev/null [ -d lib/firmware ] && { ( while read fwfile; do [ -f "${fwfile}" ] && { md5sum "${fwfile}" | sed 's/ \{1,\}/,\//g' ;} done< <( find lib/firmware -printf "%p\n" ) ) | sort -t, -k2,2 ;} popd 2>&1 > /dev/null } function inventory_os_firmware() { [ -f /proc/modules ] && { while read fwfile; do [ -f "${fwfile}" ] && { md5sum "${fwfile}" | sed 's/ \{1,\}/,/g' ;} || printf "MISSING_ON_OS,${fwfile}\n" done< <( while read module; do modinfo -F firmware "${module}" | sed -e 's?^?/lib/firmware/?g' ; done< <( awk '{print $1}' /proc/modules ) | sort -k2,2 ) ;} } inventory_os_firmware > /tmp/os-fw-inv cat /tmp/os-fw-inv #[ -s /tmp/os-fw-inv ] && echo y #inventory_osinitrd_firmware /tmp/Q > /tmp/os-initrd-fw-inv #cmp -s /tmp/os-initrd-fw-inv /tmp/os-fw-inv #pwd #/boot/.initrd-fw-inventory