pmaports/main/postmarketos-mkinitfs/mkinitfs_test.sh
Oliver Smith 23c58a681f
main/postmarketos-mkinitfs: modules from files (!1123)
Read kernel module names from files in
/etc/postmarketos-mkinitfs/modules and print out which modules are
required by which of these files as the initramfs gets generated. Put
the default modules into a new 00-default.modules. This allows mkinitfs
hooks to add modules to the initramfs.

Parse the modules from a file similar to modules-load.d, with commented
lines and empty lines ignored. Add a simple test script for that and run
it in check().
2020-04-12 00:56:22 +02:00

22 lines
364 B
Bash

#!/bin/sh -e
# Test single functions of mkinitfs_functions.sh. Add -x for verbosity.
. ./mkinitfs_functions.sh
echo ":: testing parse_file_as_line()"
cat << EOF > _test
# comment
module1
module2
# comment2
module3
EOF
if [ "$(parse_file_as_line _test)" != "module1 module2 module3" ]; then
echo "ERROR in line $LINENO"
exit 1
fi
echo ":: all tests passed"