Skip to content

Commit 4e28363

Browse files
committed
Remove trailing slash from $SRCDIR and check for required env vars
If $SRCDIR has a trailing slash (e.g., `kernel/`), the command `cp -r "$SRCDIR" "${SRCDIR}.orig"` incorrectly copies the backup *inside* the source directory instead of alongside it. This causes the subsequent `diff -Nupr` to fail or compute an incorrect diff. Also checks for the definitions of required env vars.
1 parent bea635f commit 4e28363

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/integration/rebase-patches

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
# ID=rhel VERSION_ID=7.8 ./rebase-patches rhel-7.7/*{.patch,.disabled}
1919
# % cp rhel-7.7/*.test rhel-7.8/
2020

21-
OUTDIR=$(pwd)/${ID}-${VERSION_ID}
21+
if [ -z "$SRCDIR" ] || [ -z "$ID" ] || [ -z "$VERSION_ID" ]; then
22+
echo "ERROR: SRCDIR, ID, and VERSION_ID environment variables must be set"
23+
exit 1
24+
fi
25+
26+
SRCDIR="${SRCDIR%/}"
27+
OUTDIR="$(pwd)/${ID}-${VERSION_ID}"
2228
mkdir -p "$OUTDIR"
2329

2430
echo "* Making backup copy of kernel sources"

0 commit comments

Comments
 (0)