diff --git a/Scripts/apply_patches.sh b/Scripts/apply_patches.sh index eb296e5..d055ebb 100755 --- a/Scripts/apply_patches.sh +++ b/Scripts/apply_patches.sh @@ -2,7 +2,45 @@ set -e -. Scripts/functions.sh +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 + + REVERSED_PATCHES=$(ls -1 ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch | sort -r) + + for FILE in $REVERSED_PATCHES; do + echo Reverse patch: $FILE + git apply --reverse --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $FILE + done + + popd +} ASIO_SRC_DIR="Sources/ASIO" ASIO_PATCH_DIR="Sources/OpenVPN3/deps/asio/patches" diff --git a/Scripts/functions.sh b/Scripts/functions.sh deleted file mode 100644 index ba8de50..0000000 --- a/Scripts/functions.sh +++ /dev/null @@ -1,39 +0,0 @@ -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 - - REVERSED_PATCHES=$(ls -1 ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch | sort -r) - - for FILE in $REVERSED_PATCHES; do - echo Reverse patch: $FILE - git apply --reverse --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $FILE - done - - popd -}