-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-paths.sh
More file actions
executable file
·29 lines (26 loc) · 902 Bytes
/
Copy pathsetup-paths.sh
File metadata and controls
executable file
·29 lines (26 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# Replace the @WHY2025_LINUX@ placeholder in patches/linux/{buildroot,kernel}.config
# with the absolute path to this repo, so Buildroot can find the kernel patches,
# overlay, and post-build script.
#
# Run once after cloning. Idempotent.
set -e
REPO=$(cd "$(dirname "$0")" && pwd)
for f in "$REPO/configs/why2025_defconfig" "$REPO/patches/linux/kernel.config"; do
if [ ! -f "$f" ]; then
echo "skip: $f (not found)"
continue
fi
if grep -q '@WHY2025_LINUX@' "$f"; then
# macOS sed needs '' for in-place; GNU sed doesn't. Detect and adapt.
if sed --version >/dev/null 2>&1; then
sed -i "s|@WHY2025_LINUX@|$REPO|g" "$f"
else
sed -i '' "s|@WHY2025_LINUX@|$REPO|g" "$f"
fi
echo "patched: $f -> $REPO"
else
echo "ok: $f (no placeholder)"
fi
done