Skip to content

Commit 841fd30

Browse files
nabijaczlewelibehlendorf
authored andcommitted
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 <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13316
1 parent c6f923f commit 841fd30

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

copy-builtin

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,8 @@ config ZFS
4343
If unsure, say N.
4444
EOF
4545

46-
add_after()
47-
{
48-
FILE="$1"
49-
MARKER="$2"
50-
NEW="$3"
51-
52-
while IFS='' read -r LINE
53-
do
54-
printf "%s\n" "$LINE"
55-
56-
if [ -n "$MARKER" ] && [ "$LINE" = "$MARKER" ]
57-
then
58-
printf "%s\n" "$NEW"
59-
MARKER=''
60-
if IFS='' read -r LINE
61-
then
62-
[ "$LINE" != "$NEW" ] && printf "%s\n" "$LINE"
63-
fi
64-
fi
65-
done < "$FILE" > "$FILE.new"
66-
67-
mv "$FILE.new" "$FILE"
68-
}
69-
70-
add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"'
71-
add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/'
46+
sed -i '/source "fs\/ext2\/Kconfig\"/i\source "fs/zfs/Kconfig"' "$KERNEL_DIR/fs/Kconfig"
47+
echo 'obj-$(CONFIG_ZFS) += zfs/' >> "$KERNEL_DIR/fs/Makefile"
7248

7349
echo "$0: done. now you can build the kernel with ZFS support." >&2
7450
echo "$0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2

0 commit comments

Comments
 (0)