From 6368f67e53ee5a372e1f96647d395fbc4e2de06a Mon Sep 17 00:00:00 2001 From: Wildan M Date: Fri, 11 Sep 2026 01:57:45 +0700 Subject: [PATCH] Add a script to create patches of tar --- scripts/patch-tar.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 scripts/patch-tar.sh diff --git a/scripts/patch-tar.sh b/scripts/patch-tar.sh new file mode 100755 index 000000000..0de84887f --- /dev/null +++ b/scripts/patch-tar.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +set -e + +# This script generates a "redox.patch" for a tar-based recipe + +if [ -z "$1" ] +then + echo "Generates a 'redox.patch' for a tar-based recipe" + echo "" + echo "Usage: $0 " + exit 1 +fi + +RECIPE_PATH=$(make find.$1) +RECIPE_PATH=${RECIPE_PATH//$'\r'/} + +if [ ! -d "$RECIPE_PATH/source" ]; then + echo "Error: 'source' directory not found" + exit 1 +fi + +if [ ! -f "$RECIPE_PATH/source.tar" ]; then + echo "Error: 'source.tar' not found" + exit 1 +fi + +export TZ=UTC +set -x + +cd $RECIPE_PATH +mv source source-new +mkdir source +tar xf source.tar -C source --strip-components=1 +diff -ruwN source source-new > redox.patch || true +rm -rf source +mv source-new source