Files
fheroes2/script/android/install_packages.sh
T

52 lines
2.5 KiB
Bash

#!/usr/bin/env bash
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2022 - 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the #
# Free Software Foundation, Inc., #
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
###########################################################################
set -e -o pipefail
PKG_FILE="android.zip"
PKG_FILE_SHA256="5c8db5488495ceb86fcfd48cc5f9c3d4123c6dd92f0b7fcc15b91c81e65ee142"
PKG_URL="https://github.com/fheroes2/fheroes2-prebuilt-deps/releases/download/android-deps/$PKG_FILE"
TMP_DIR="$(mktemp -d)"
if [[ -n "$(command -v wget)" ]]; then
wget -O "$TMP_DIR/$PKG_FILE" "$PKG_URL"
elif [[ -n "$(command -v curl)" ]]; then
curl -o "$TMP_DIR/$PKG_FILE" -L "$PKG_URL"
else
echo "Neither wget nor curl were found in your system. Unable to download the package archive. Installation aborted."
exit 1
fi
echo "$PKG_FILE_SHA256 *$PKG_FILE" > "$TMP_DIR/checksums"
if [[ -n "$(command -v shasum)" ]]; then
(cd "$TMP_DIR" && shasum --check --algorithm 256 checksums)
elif [[ -n "$(command -v sha256sum)" ]]; then
(cd "$TMP_DIR" && sha256sum --check --strict checksums)
else
echo "Neither shasum nor sha256sum were found in your system. Unable to verify the downloaded file. Installation aborted."
exit 1
fi
unzip -d "$(dirname "$0")/../../android" "$TMP_DIR/$PKG_FILE"