Extract args processing in deps scripts
Extract the code which process arguments to a function. This will make it optional, so that the script which just downloads the official adb binaries does not use arguments.
This commit is contained in:
parent
efea97a026
commit
1569de761b
@ -3,6 +3,7 @@ set -ex
|
|||||||
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
cd "$DEPS_DIR"
|
cd "$DEPS_DIR"
|
||||||
. common
|
. common
|
||||||
|
process_args "$@"
|
||||||
|
|
||||||
VERSION=35.0.2
|
VERSION=35.0.2
|
||||||
FILENAME=platform-tools_r$VERSION-win.zip
|
FILENAME=platform-tools_r$VERSION-win.zip
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This file is intended to be sourced by other scripts, not executed
|
# This file is intended to be sourced by other scripts, not executed
|
||||||
|
|
||||||
if [[ $# != 1 ]]
|
process_args() {
|
||||||
then
|
if [[ $# != 1 ]]
|
||||||
# <host>: win32 or win64
|
then
|
||||||
echo "Syntax: $0 <host>" >&2
|
# <host>: win32 or win64
|
||||||
exit 1
|
echo "Syntax: $0 <host>" >&2
|
||||||
fi
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
HOST="$1"
|
HOST="$1"
|
||||||
|
|
||||||
if [[ "$HOST" = win32 ]]
|
if [[ "$HOST" = win32 ]]
|
||||||
then
|
then
|
||||||
HOST_TRIPLET=i686-w64-mingw32
|
HOST_TRIPLET=i686-w64-mingw32
|
||||||
elif [[ "$HOST" = win64 ]]
|
elif [[ "$HOST" = win64 ]]
|
||||||
then
|
then
|
||||||
HOST_TRIPLET=x86_64-w64-mingw32
|
HOST_TRIPLET=x86_64-w64-mingw32
|
||||||
else
|
else
|
||||||
echo "Unsupported host: $HOST" >&2
|
echo "Unsupported host: $HOST" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
cd "$DEPS_DIR"
|
cd "$DEPS_DIR"
|
||||||
|
@ -3,6 +3,7 @@ set -ex
|
|||||||
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
cd "$DEPS_DIR"
|
cd "$DEPS_DIR"
|
||||||
. common
|
. common
|
||||||
|
process_args "$@"
|
||||||
|
|
||||||
VERSION=7.1
|
VERSION=7.1
|
||||||
FILENAME=ffmpeg-$VERSION.tar.xz
|
FILENAME=ffmpeg-$VERSION.tar.xz
|
||||||
|
@ -3,6 +3,7 @@ set -ex
|
|||||||
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
cd "$DEPS_DIR"
|
cd "$DEPS_DIR"
|
||||||
. common
|
. common
|
||||||
|
process_args "$@"
|
||||||
|
|
||||||
VERSION=1.0.27
|
VERSION=1.0.27
|
||||||
FILENAME=libusb-$VERSION.tar.gz
|
FILENAME=libusb-$VERSION.tar.gz
|
||||||
|
@ -3,6 +3,7 @@ set -ex
|
|||||||
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
cd "$DEPS_DIR"
|
cd "$DEPS_DIR"
|
||||||
. common
|
. common
|
||||||
|
process_args "$@"
|
||||||
|
|
||||||
VERSION=2.30.9
|
VERSION=2.30.9
|
||||||
FILENAME=SDL-$VERSION.tar.gz
|
FILENAME=SDL-$VERSION.tar.gz
|
||||||
|
Loading…
x
Reference in New Issue
Block a user