copy-builtin: add hooks with sed/>>
The order in fs/Makefile doesn't matter, the order in fs/Kconfig is preserved (ext2 is included as the first thing in the first if BUILD block, and only once), but I don't think it matters much either, realistically Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13316
This commit is contained in:
parent
c6f923fba4
commit
841fd303b8
28
copy-builtin
28
copy-builtin
|
@ -43,32 +43,8 @@ config ZFS
|
||||||
If unsure, say N.
|
If unsure, say N.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
add_after()
|
sed -i '/source "fs\/ext2\/Kconfig\"/i\source "fs/zfs/Kconfig"' "$KERNEL_DIR/fs/Kconfig"
|
||||||
{
|
echo 'obj-$(CONFIG_ZFS) += zfs/' >> "$KERNEL_DIR/fs/Makefile"
|
||||||
FILE="$1"
|
|
||||||
MARKER="$2"
|
|
||||||
NEW="$3"
|
|
||||||
|
|
||||||
while IFS='' read -r LINE
|
|
||||||
do
|
|
||||||
printf "%s\n" "$LINE"
|
|
||||||
|
|
||||||
if [ -n "$MARKER" ] && [ "$LINE" = "$MARKER" ]
|
|
||||||
then
|
|
||||||
printf "%s\n" "$NEW"
|
|
||||||
MARKER=''
|
|
||||||
if IFS='' read -r LINE
|
|
||||||
then
|
|
||||||
[ "$LINE" != "$NEW" ] && printf "%s\n" "$LINE"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done < "$FILE" > "$FILE.new"
|
|
||||||
|
|
||||||
mv "$FILE.new" "$FILE"
|
|
||||||
}
|
|
||||||
|
|
||||||
add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"'
|
|
||||||
add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/'
|
|
||||||
|
|
||||||
echo "$0: done. now you can build the kernel with ZFS support." >&2
|
echo "$0: done. now you can build the kernel with ZFS support." >&2
|
||||||
echo "$0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2
|
echo "$0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2
|
||||||
|
|
Loading…
Reference in New Issue