diff options
author | dakkar <dakkar@thenautilus.net> | 2018-07-13 09:56:16 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2018-07-13 09:56:16 +0100 |
commit | 51179e2339edce30927d94b033118319be7b19f3 (patch) | |
tree | 9f5bcde55d31a7976ed2d95d08010e0c12ad7b6a /apply-patches.sh | |
download | dakkar-android-huawei-m5-51179e2339edce30927d94b033118319be7b19f3.tar.gz dakkar-android-huawei-m5-51179e2339edce30927d94b033118319be7b19f3.tar.bz2 dakkar-android-huawei-m5-51179e2339edce30927d94b033118319be7b19f3.zip |
first attempt
Diffstat (limited to 'apply-patches.sh')
-rw-r--r-- | apply-patches.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/apply-patches.sh b/apply-patches.sh new file mode 100644 index 0000000..44d416e --- /dev/null +++ b/apply-patches.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# copied from github.com:phhusson/treble_experimentations + +set -e + +patches="$(readlink -f -- $1)" + +for project in $(cd $patches/patches; echo *);do + p="$(tr _ / <<<$project |sed -e 's;platform/;;g')" + [ "$p" == build ] && p=build/make + repo sync -l --force-sync $p + pushd $p + git clean -fdx; git reset --hard + for patch in $patches/patches/$project/*.patch;do + #Check if patch is already applied + if patch -f -p1 --dry-run -R < $patch > /dev/null;then + continue + fi + + if git apply --check $patch;then + git am $patch + elif patch -f -p1 --dry-run < $patch > /dev/null;then + #This will fail + git am $patch || true + patch -f -p1 < $patch + git add -u + git am --continue + else + echo "Failed applying $patch" + fi + done + popd +done + |