0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-22 05:33:03 -05:00

add test-patch.sh

This commit is contained in:
Malte Jürgens 2023-03-15 12:00:26 +01:00
parent 46a6f86069
commit 5ce599ab1b
No known key found for this signature in database
GPG key ID: D29FBD5F93C0CFC3

35
scripts/test-patch.sh Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/bash
set -eu
if [ $# -ne 1 ]; then
echo "Usage: $0 <path to patch>"
exit 1
fi
if [ "$1" == "${1%.patch}" ]; then
echo "Error: '$1' does not seem to be a patch."
exit 1
fi
cd "$(dirname "$0")/.."
version="$(cat version)"
if [ -d "firefox-$version" ]; then
echo "-> Removing old 'firefox-$version'"
rm -rf "firefox-$version"
fi
echo "-> Extracting 'firefox-$version.source.tar.xz'"
make "firefox-$version.source.tar.xz"
tar xf "firefox-$version.source.tar.xz"
cd "firefox-$version"
echo "-> Settings up git"
git init
files="$(cat ../$1 | grep '+++ b/' | sed 's/\+\+\+ b\///')"
echo "$files" | xargs touch
echo "$files" | xargs git add
echo "-> Done"
echo "You can now apply the patch with:"
echo " cd 'firefox-$version' && patch -p1 -i '$(readlink -f ../$1)'"