mes/scripts/include.mes
Jan Nieuwenhuizen b8a7334941 Bugfix include.mes: skip commented modules.
* scripts/include.mes: Make regexp more strict.
2016-12-12 20:33:49 +01:00

24 lines
577 B
Bash
Executable file

#! /bin/sh
if [ "$1" == "--help" ]; then
echo "Usage: include.mes FILE"
exit 0
fi
for prefix in $(dirname $(dirname $0))/share/mes . $(dirname $(dirname $0)); do
if [ -d ${prefix}/module ]; then
break;
fi
done
if [ -n "$BOOT" ]; then
echo $prefix/module/mes/loop-0.mes
if [ -n "$TYPE0" ]; then
echo $prefix/module/mes/type-0.mes
fi
echo $prefix/module/mes/mes-0.mes
fi
cat $1 \
| grep -Eo '^\(mes-use-module \([^ ()]+ [^()]+))' \
| grep -Eo ' \([^)]+\)' \
| sed -e "s@^ *(@${prefix}/module/@" -e 's@ @/@g' -e 's@)@.mes@'