Compare commits

..

5 Commits

2 changed files with 73 additions and 4 deletions

View File

@@ -0,0 +1,49 @@
#!/bin/bash
# I keep forgetting how to extract the boot.img from an Android OTA update
# for patching by Magisk.
set -e
while [[ $# -gt 0 ]]; do
case $1 in
--payload-dumper)
# Specify the path to the payload_dumper binary
PAYLOAD_DUMPER=$2
shift
shift
;;
--diff)
PAYLOAD_DUMPER_EXTRA_ARGS="${PAYLOAD_DUMPER_EXTRA_ARGS} --diff"
shift
;;
*)
# The last argument is the file
UPDATE_FILE=$1
shift
;;
esac
done
if [[ ! -f "$UPDATE_FILE" ]]; then
echo "Android update file $UPDATE_FILE does not exist"
exit 1
fi
out_dir=./payload-dumper-output
if [[ -d "$out_dir" ]]; then
echo "Output path $out_dir already exists. Refusing to work!"
exit 1
fi
mkdir "$out_dir"
# Print some basic info
PAYLOAD_DUMPER=${PAYLOAD_DUMPER:-payload_dumper}
echo "INFO: payload_dumper: $PAYLOAD_DUMPER"
echo
# Extract only the payload.bin file
echo "Extracting payload..."
unzip -q -C "$UPDATE_FILE" -d "$out_dir" payload.bin
# Use payload_dumper to get to the boot.img
echo "Dumping data from payload..."
${PAYLOAD_DUMPER} ${PAYLOAD_DUMPER_EXTRA_ARGS} --out "$out_dir" "${out_dir}/payload.bin"

View File

@@ -80,6 +80,18 @@ while [[ $# -gt 0 ]]; do
SEND_NOTIFICATION=n
shift
;;
--pigeon)
# Specifies to run `dart run pigeon --input $2`
PIGEON_FILES="$PIGEON_FILES $2"
shift
shift
;;
--flutter)
# Specifies the path to the flutter binary
FLUTTER=$2
shift
shift
;;
*)
echo "Unknown argument: $1"
shift
@@ -101,6 +113,7 @@ CLEAN_BUILD=${CLEAN_BUILD:-y}
SKIP_BUILD=${SKIP_BUILD:-n}
NOTIFY_SEND=${NOTIFY_SEND:-notify-send}
SEND_NOTIFICATION=${SEND_NOTIFICATION:-y}
FLUTTER=${FLUTTER:-flutter}
# Parse version info
version=$(grep -E "^version: " pubspec.yaml | cut -b 10-)
@@ -112,7 +125,9 @@ release_dir="./release-${version}"
echo "===== ${NAME} ====="
echo "Building version ${version}"
echo "Moving APKs into ${release_dir} after build"
echo "Flutter: ${FLUTTER}"
echo "Clean build: ${CLEAN_BUILD}"
echo "Pigeons to build: ${PIGEON_FILES}"
echo "Skipping build: ${SKIP_BUILD}"
echo "Sending notification: ${SEND_NOTIFICATION}"
echo "APKs already signed: ${ALREADY_SIGNED}"
@@ -146,17 +161,22 @@ else
if [[ "${CLEAN_BUILD}" = "y" ]]; then
# Clean flutter build
flutter clean
$FLUTTER clean
fi
# Get dependencies
flutter pub get
$FLUTTER pub get
# Build everything again
flutter pub run build_runner build --delete-conflicting-outputs
$FLUTTER pub run build_runner build --delete-conflicting-outputs
# Build pigeons
for pigeon in $PIGEON_FILES; do
$FLUTTER pub run pigeon --input $pigeon
done
# Build the release apk
flutter build apk \
$FLUTTER build apk \
--release \
--split-per-abi \
--split-debug-info="${release_dir}/debug-info"