5739103f6c
The line containing @KFLAVOUR is expanded into several lines, it is successively replaced with values from the KFLAVOURS variable. This will allow to specify kernel modules and kernel headers in lists.
22 lines
340 B
Bash
Executable File
22 lines
340 B
Bash
Executable File
#!/bin/sh -efu
|
|
|
|
kflavours="${1:-}"
|
|
[ -n "$kflavours" ] || exit 0
|
|
|
|
f="${2:-}"
|
|
[ -n "$f" ] || exit 0
|
|
|
|
grep -q @KFLAVOUR "$f" || exit 0
|
|
|
|
while IFS= read -r line; do
|
|
if [[ "$line" =~ @KFLAVOUR ]]; then
|
|
for i in $kflavours; do
|
|
echo "$line" | sed "s/@KFLAVOUR/$i/"
|
|
done
|
|
else
|
|
echo "$line"
|
|
fi
|
|
done < "$f" > "$f".temp
|
|
|
|
mv "$f".temp "$f"
|