refactor(mk): move build rules into separate scripts (#855)
See https://github.com/ooni/probe/issues/2218
This commit is contained in:
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
GOOS=$(go env GOOS)
|
||||
case $GOOS in
|
||||
linux)
|
||||
__sdk_dir=$HOME/Android/Sdk
|
||||
;;
|
||||
darwin)
|
||||
__sdk_dir=$HOME/Library/Android/sdk
|
||||
;;
|
||||
*)
|
||||
echo "FATAL: unsupported operating system" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
ANDROID_HOME=${ANDROID_HOME:-$__sdk_dir}
|
||||
|
||||
__clitools_version=8512546
|
||||
__clitools_file=commandlinetools-linux-${__clitools_version}_latest.zip
|
||||
__clitools_sha256=2ccbda4302db862a28ada25aa7425d99dce9462046003c1714b059b5c47970d8
|
||||
|
||||
printf "checking for curl... "
|
||||
command -v curl || {
|
||||
echo "not found"
|
||||
exit 1
|
||||
}
|
||||
printf "checking for shasum... "
|
||||
command -v shasum || {
|
||||
echo "not found"
|
||||
exit 1
|
||||
}
|
||||
printf "checking for unzip... "
|
||||
command -v unzip || {
|
||||
echo "not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -x
|
||||
rm -rf $ANDROID_HOME/cmdline-tools/latest
|
||||
curl -fsSLO https://dl.google.com/android/repository/$__clitools_file
|
||||
echo "$__clitools_sha256 $__clitools_file" >__SHA256
|
||||
shasum --check __SHA256
|
||||
rm -f __SHA256
|
||||
unzip $__clitools_file
|
||||
rm $__clitools_file
|
||||
mkdir -p $ANDROID_HOME/cmdline-tools
|
||||
# See https://stackoverflow.com/a/61176718 to understand why
|
||||
# we need to reorganize the directories like this:
|
||||
mv cmdline-tools $ANDROID_HOME/cmdline-tools/latest
|
||||
Reference in New Issue
Block a user