61 lines
1.1 KiB
Bash
Executable File
61 lines
1.1 KiB
Bash
Executable File
#!/data/data/com.termux/files/usr/bin/bash
|
|
set -e
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
source "$ROOT_DIR/lib/common.sh"
|
|
|
|
APK="$(get_apk_path)"
|
|
BUILD_TYPE="$(get_build_type)"
|
|
|
|
if [ ! -f "$APK" ]; then
|
|
echo "No $BUILD_TYPE APK found."
|
|
echo
|
|
echo "Run:"
|
|
echo " android-builder build"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$HOME/storage" ]; then
|
|
echo "==> Termux storage has not been configured."
|
|
echo "==> Requesting storage permission..."
|
|
echo
|
|
|
|
termux-setup-storage
|
|
|
|
echo
|
|
echo "Please grant storage permission, then run:"
|
|
echo " android-builder export"
|
|
exit 0
|
|
fi
|
|
|
|
EXPORT_DIR="$HOME/storage/documents"
|
|
mkdir -p "$EXPORT_DIR"
|
|
|
|
PROJECT_NAME="$(get_project_name)"
|
|
DEST="$EXPORT_DIR/${PROJECT_NAME}.apk"
|
|
|
|
echo "==> Exporting APK..."
|
|
|
|
cp -f "$APK" "$DEST"
|
|
sync
|
|
|
|
SIZE="$(du -h "$DEST" | cut -f1)"
|
|
|
|
echo
|
|
echo "✓ Export complete!"
|
|
echo
|
|
echo "Project:"
|
|
echo " $PROJECT_NAME"
|
|
echo
|
|
echo "Build:"
|
|
echo " $BUILD_TYPE"
|
|
echo
|
|
echo "Size:"
|
|
echo " $SIZE"
|
|
echo
|
|
echo "Location:"
|
|
echo " $DEST"
|
|
echo
|
|
echo "Open your file manager, browse to Documents,"
|
|
echo "then tap ${PROJECT_NAME}.apk to install or share it."
|