1#!/bin/bash
2# This library is free software; you can redistribute it and/or
3# modify it under the terms of the GNU Lesser General Public
4# License as published by the Free Software Foundation version 2.1
5# of the License.
6#
7# Copyright(c) 2023 Huawei Device Co., Ltd.
8
9set -e
10cd $1
11{
12flock -x 100
13if [ -d "grpc" ];then
14    rm -rf grpc
15fi
16tar -zxvf grpc-1.41.1.tar.gz
17mv grpc-1.41.1 grpc
18cd $1/grpc
19patch -p1 < $1/src_core_lib_debug.patch
20patch -p1 < $1/src_core_lib_iomgr.patch
21patch -p1 < $1/backport-Ignore-Connection-Aborted-errors-on-accept-29318.patch
22patch -p1 < $1/backport-iomgr-EventEngine-Improve-server-handling-o.patch
23patch -p1 < $1/fix-CVE-2023-33953-add-header-limit.patch
24patch -p1 < $1/fix-CVE-2023-44487.patch
25patch -p1 < $1/fix-memory-leak.patch
26flock -u 100
27} 100<>$1/lock_file.lock
28exit 0