Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions netfilter-match-modules/integrate_netfilter_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ insert_lines_at()
remainder=$(($file_length - $insert_after))

head -n $insert_after $file >.tmp.tmp
printf "$lines\n" >>.tmp.tmp
# Snippet files double up literal '%' as '%%' (needed in nft_print/sprintf format
# strings, bison %token directives, flex %s start conditions) so it survives this
# insertion step as a single '%'. Do that collapse explicitly with sed rather than
# by handing $lines to printf as a FORMAT string -- shells disagree on how printf
# handles the unrelated "\"" in $lines (bash's builtin drops the backslash, dash's
# doesn't), which silently corrupted the emitted C on any system where /bin/sh is
# bash (e.g. Arch) even though genuine %-escapes were handled correctly everywhere.
printf '%s\n' "$lines" | sed 's/%%/%/g' >>.tmp.tmp
if [ $remainder -gt 0 ] ; then
tail -n $remainder $file >>.tmp.tmp
fi
Expand Down Expand Up @@ -123,7 +130,7 @@ if [ "$patch_kernel" = 1 ] ; then
board_var=$(cat target/linux/$target_name/Makefile | grep "BOARD.*:=")
kernel_var=$(cat target/linux/$target_name/Makefile | grep "KERNEL.*:=")
linux_ver_var=$(cat target/linux/$target_name/Makefile | grep "LINUX_VERSION.*:=")
defines=$(printf "$board_var\n$kernel_var\n$linux_ver_var\n")
defines=$(printf '%s\n%s\n%s\n' "$board_var" "$kernel_var" "$linux_ver_var")

cat << 'EOF' >nf-patch-build/linux-download-make
CP:=cp -fpR
Expand All @@ -140,7 +147,7 @@ DOWNLOAD_CHECK_CERTIFICATE:=$(CONFIG_DOWNLOAD_CHECK_CERTIFICATE)
export DOWNLOAD_CHECK_CERTIFICATE
EOF

printf "$defines\n" >> nf-patch-build/linux-download-make
printf '%s\n' "$defines" >> nf-patch-build/linux-download-make

cat << 'EOF' >>nf-patch-build/linux-download-make
GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic
Expand Down
Loading