Created
July 26, 2018 18:17
-
-
Save oldgalileo/901e8acaa8a3afe74bbc902a86785242 to your computer and use it in GitHub Desktop.
Simple script to test either bsdiff/bspatch of ext4 images, or test that the creation of the ext4 images are deterministic/identical
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 | |
git clone git://git.openwrt.org/project/make_ext4fs.git make_ext4fs-git | |
cd make_ext4fs-git && make && cp make_ext4fs ../ | |
cd ../ | |
dd if=/dev/zero of=testA.ext4 bs=1m count=50 | |
dd if=/dev/zero of=testB.ext4 bs=1m count=50 | |
./make_ext4fs -T 1531952117 -l 50M -b=1M -g=50 testA.ext4 | |
./make_ext4fs -T 1531952117 -l 50M -b=1M -g=50 testB.ext4 | |
echo "pre-mount:" | |
echo "testA: `shasum testA.ext4`" | |
echo "testB: `shasum testB.ext4`" | |
echo "`pwd`" | |
mkdir tempA/ | |
mkdir tempB/ | |
sudo mount -o loop,noatime -t ext4 testA.ext4 tempA/ | |
sudo mount -o loop,noatime -t ext4 testB.ext4 tempB/ | |
sudo sh -c "echo 'hello' >> tempA/hello" | |
sudo sh -c "echo 'hello' >> tempB/hello" | |
sudo sh -c "echo 'world' >> tempB/world" | |
sudo umount tempA/ | |
sudo umount tempB/ | |
echo "post-mount:" | |
echo "testA: `shasum testA.ext4`" | |
echo "testB: `shasum testB.ext4`" | |
echo "running bsdiff (this may take a while. est 10min)" | |
bsdiff testA.ext4 testB.ext4 patchC.patch | |
echo "patch: `shasum patchC.patch`" | |
echo "running bspatch" | |
bspatch testA.ext4 testC.ext4 patchC.patch | |
echo "post-patch:" | |
echo "testA: `shasum testA.ext4`" | |
echo "testB: `shasum testB.ext4`" | |
echo "testC: `shasum testC.ext4`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment