echo
echo "-h, --help print a help message and exit."
echo "-s, --size sort the contents of the initramfs by size."
+ echo "-m, --mod list modules."
echo "-f, --file <filename> print the contents of <filename>."
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
echo
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
sorted=0
+modules=0
declare -A filenames
unset POSIXLY_CORRECT
TEMP=$(getopt \
- -o "shf:k:" \
+ -o "shmf:k:" \
--long kver: \
--long file: \
+ --long mod \
--long help \
--long size \
-- "$@")
-f|--file) filenames[${2#/}]=1; shift;;
-s|--size) sorted=1;;
-h|--help) usage; exit 0;;
+ -m|--mod) modules=1;;
--) shift;break;;
*) usage; exit 1;;
esac
done
}
+list_modules()
+{
+ echo "dracut modules:"
+ $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
+ ((ret+=$?))
+}
+
list_files()
{
echo "========================================================================"
((ret+=$?))
echo "Version: $version"
echo
- echo -n "Arguments: "
- $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
- echo
- echo "dracut modules:"
- $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
- ((ret+=$?))
- list_files
+ if [ "$modules" -eq 1 ]; then
+ list_modules
+ echo "========================================================================"
+ else
+ echo -n "Arguments: "
+ $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
+ echo
+ list_modules
+ list_files
+ fi
fi
exit $ret