1#!/bin/bash 2# Copyright (C) 2023 Huawei Device Co., Ltd. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15set -e 16{ 17if [ "$(uname)" != "Darwin" ];then 18 flock -x 100 19fi 20if [ -d "$1/libusb-1.0.28" ];then 21 rm -rf $1/libusb-1.0.28 22fi 23tar -zxvf $2/libusb-1.0.28.tar.gz -C $1 24cp $2/hide-log-dev-id.patch $1/ 25cp $2/fix-init-fail.patch $1/ 26cd $1/libusb-1.0.28/ 27patch -p1 < ../hide-log-dev-id.patch 28patch -p1 < ../fix-init-fail.patch 29if [ "$(uname)" != "Darwin" ];then 30 flock -u 100 31fi 32} 100<>$2/lock_file.lock 33exit 0 34