Created
November 26, 2023 17:55
-
-
Save danielml3/89204b770e6841bd848d52c147c3f308 to your computer and use it in GitHub Desktop.
Script for diffing two boot images using Git and AIK (Android Image Kitchen)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
ORIGINAL_IMG=$1 | |
NEW_IMG=$2 | |
if [ -z $ORIGINAL_IMG ] || [ -z $NEW_IMG ]; then | |
echo "usage: ./bootimgdiff.sh <original-img> <new-img>" | |
exit 1 | |
fi | |
if [ "$EUID" -ne 0 ]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
IMGNAME=$(basename $ORIGINAL_IMG) | |
if [ -f $IMGNAME ] || [ -d $IMGNAME ]; then | |
rm -rf $IMGNAME | |
fi | |
mkdir $IMGNAME | |
# Unpack the original image and move the contents to the img diff directory | |
./unpackimg.sh $ORIGINAL_IMG | |
mv ramdisk $IMGNAME | |
mv split_img $IMGNAME | |
./cleanup.sh | |
# Init a git repository and add all files | |
cd $IMGNAME | |
git init | |
git add . | |
# Remove the files | |
rm -rf ramdisk | |
rm -rf split_img | |
cd .. | |
# Unpack the new image and move the contents to the img diff directory | |
./unpackimg.sh $NEW_IMG | |
mv ramdisk $IMGNAME | |
mv split_img $IMGNAME | |
./cleanup.sh | |
echo "Diff available at: $IMGNAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment