mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-01-31 00:00:06 +08:00
Add scripts to apply patches
This commit is contained in:
19
Scripts/apply_patches.sh
Executable file
19
Scripts/apply_patches.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. functions.sh
|
||||
|
||||
ASIO_SRC_DIR="../Sources/ASIO"
|
||||
ASIO_PATCH_DIR="../Sources/OpenVPN3/deps/asio/patches"
|
||||
|
||||
MBEDTLS_SRC_DIR="../Sources/mbedTLS"
|
||||
MBEDTLS_PATCH_DIR="../Sources/OpenVPN3/deps/mbedtls/patches"
|
||||
|
||||
if [ "$1" = "--reverse" ]; then
|
||||
reverse_patches ${ASIO_SRC_DIR} ${ASIO_PATCH_DIR}
|
||||
reverse_patches ${MBEDTLS_SRC_DIR} ${MBEDTLS_PATCH_DIR}
|
||||
else
|
||||
apply_patches ${ASIO_SRC_DIR} ${ASIO_PATCH_DIR}
|
||||
apply_patches ${MBEDTLS_SRC_DIR} ${MBEDTLS_PATCH_DIR}
|
||||
fi
|
||||
37
Scripts/functions.sh
Normal file
37
Scripts/functions.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
function apply_patches()
|
||||
{
|
||||
DEP_SRC_DIR=$1
|
||||
DEP_PATCH_DIR=$2
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
pushd ${CURRENT_DIR}
|
||||
|
||||
cd /tmp
|
||||
|
||||
for file in ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch; do
|
||||
echo Applying patch: $file
|
||||
git apply --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $file
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function reverse_patches()
|
||||
{
|
||||
DEP_SRC_DIR=$1
|
||||
DEP_PATCH_DIR=$2
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
pushd ${CURRENT_DIR}
|
||||
|
||||
cd /tmp
|
||||
|
||||
for file in ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch; do
|
||||
echo Reverse patch: $file
|
||||
git apply --reverse --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $file
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
Reference in New Issue
Block a user