#!/usr/bin/env bash set -euo pipefail BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" RELEASE_DIR="$BASE_DIR/release_folder" echo "=== Preparing Release Directory ===" rm -rf "$RELEASE_DIR" mkdir -p "$RELEASE_DIR" echo "=== Building SuManager APK ===" cd "$BASE_DIR/sumanager" ./build.sh echo "=== Building SlopRoot APK ===" cd "$BASE_DIR/app" ./build.sh echo "=== Packaging Final SlopRoot.apk ===" cp "$BASE_DIR/app/build/sloproot.apk" "$RELEASE_DIR/SlopRoot.apk" echo "=== Creating Maximally Compressed Clean Sources Archive ===" cd "$BASE_DIR" # Create a temporary staging archive excluding git, sdk, binaries, and caches tar \ --exclude='.git' \ --exclude='.gemini' \ --exclude='release_folder' \ --exclude='Legacy_TOOLS' \ --exclude='android-sdk' \ --exclude='avd' \ --exclude='app/build' \ --exclude='sumanager/build' \ --exclude='app/assets/arm/su' \ --exclude='app/assets/armv6/su' \ --exclude='app/assets/armv5/su' \ --exclude='app/assets/x86/su' \ --exclude='app/assets/arm64/su' \ --exclude='app/assets/x86_64/su' \ --exclude='app/assets/arm/dirtycow' \ --exclude='app/assets/arm/payload' \ --exclude='app/assets/armv6/dirtycow' \ --exclude='app/assets/armv6/payload' \ --exclude='app/assets/armv5/dirtycow' \ --exclude='app/assets/armv5/payload' \ --exclude='app/assets/x86/dirtycow' \ --exclude='app/assets/x86/payload' \ --exclude='app/assets/arm/sumanager.apk' \ --exclude='app/assets/common/sumanager.apk' \ --exclude='*.keystore' \ --exclude='docs/screenshots' \ --exclude='screenshots' \ --exclude='__pycache__' \ --exclude='*.pyc' \ --exclude='*.tmp*' \ --exclude='*.log' \ -cf - . | gzip -9 > "$RELEASE_DIR/sources.tar.gz" echo "=== Verifying Release Folder Contents ===" RELEASE_COUNT=$(find "$RELEASE_DIR" -maxdepth 1 -type f | wc -l) if [ "$RELEASE_COUNT" -ne 2 ]; then echo "ERROR: release_folder must contain exactly 2 files (SlopRoot.apk, sources.tar.gz)" >&2 exit 1 fi echo "Release build completed successfully in $RELEASE_DIR:" ls -lh "$RELEASE_DIR"