remove setup android sdk script

This commit is contained in:
WMCB-Tech 2021-08-27 19:04:46 +08:00
parent d78d8778c9
commit 38e9fe9c1c

View File

@ -1,43 +0,0 @@
#!/bin/bash
set -e -u
ANDROID_SDK_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip"
ANDROID_SDK_ROOT="${HOME}/android-sdk"
TMP="$(mktemp -d)"
# check if running under root
if [ "$(id -u)" == "0" ]; then
SUDO=""
else
SUDO="sudo -Es"
fi
# install dependencies
${SUDO} bash -c \
"apt install curl file unzip || pacman -S curl file unzip --needed || dnf install curl file unzip"
# check java in PATH
if ! "$(command -v java)" !>/dev/null 2>&1; then
echo "No java on your device is installed! please install openjdk. version 8 is recommended"
exit 2
fi
# setup android sdk
curl --fail --location "${ANDROID_SDK_TOOLS_URL}" \
--output "${TMP:-/tmp}/sdk.zip"
unzip -d "${ANDROID_SDK_ROOT}" "${TMP:-/tmp}/sdk.zip" -qq
# accept licenses
yes | "${ANDROID_SDK_ROOT}"/cmdline-tools/bin/sdkmanager --licenses \
--sdk_root="${ANDROID_SDK_ROOT}"
if [ "${?}" == "0" ]; then
cat <<- EOL
Success installing Android SDK tools!
At this point you can specify the ANDROID_HOME variable to ${ANDROID_SDK_ROOT}
EOL
else
echo "An error has occured during the installation"
exit 2
fi