Last active
March 10, 2018 23:33
-
-
Save zeevox/7bea9deaf9dae4fd1bc307004469833e to your computer and use it in GitHub Desktop.
Unpack Android installable flashable zip files
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 | |
echo "***********************************************" | |
echo "* Installable flashable zip content extractor *" | |
echo "* by ZeevoX *" | |
echo "***********************************************" | |
echo "Preparing..." | |
############################################## | |
### THIS SCRIPT NEEDS 7ZIP v14+ INSTALLED! ### | |
############################################## | |
# To install 7zip | |
#sudo add-apt-repository -y ppa:eugenesan/ppa > /dev/null | |
# Refresh repo | |
# sudo apt-get -qq update | |
# Check all required dependencies are installed | |
#command -v 7z >/dev/null 2>&1 || { echo >&2 "I: 7z is not installed but required, installing..."; sudo apt-get -y -q install p7zip p7zip-full; } | |
# install latest 7zip regardless if installed or not | |
#sudo apt-get -y -q install p7zip p7zip-full | |
command -v git >/dev/null 2>&1 || { echo >&2 "I: wget is not installed but required, will install"; sudo apt-get -y -q install git; } | |
command -v python >/dev/null 2>&1 || { echo >&2 "I: wget is not installed but required, will install"; sudo apt-get -y -q install python; } | |
command -v unzip >/dev/null 2>&1 || { echo >&2 "I: unzip is not installed but required, will install"; sudo apt-get -y -q install unzip; } | |
command -v wget >/dev/null 2>&1 || { echo >&2 "I: wget is not installed but required, will install"; sudo apt-get -y -q install wget; } | |
echo -n "Please enter zip download link: " | |
read download_link | |
echo "Processing..." | |
filename=$(sed 's#.*/##' <<< $download_link) | |
mkdir ${filename:0:-4} | |
cd ${filename:0:-4} | |
#echo $filename | |
#read -n 1 -s -r -p "Press any key to continue" | |
echo "Downloading..." | |
# We use -c to not download the file again if it has already been downloaded or downloaded partially | |
wget -c $download_link | |
echo "Extracting raw data..." | |
unzip -qq $filename system.transfer.list system.new.dat | |
echo "Downloading conversion tool..." | |
git clone --quiet https://github.com/xpirt/sdat2img | |
echo "Converting raw data into disk image..." | |
python sdat2img/sdat2img.py system.transfer.list system.new.dat ${filename}.img > /dev/null | |
echo "Cleaning up..." | |
rm -rf system.transfer.list system.new.dat sdat2img/ | |
echo "Extracting files..." | |
7z -y -bsp0 -bso0 x ${filename}.img | |
rm ${filename}.img ${filename} | |
# -y -bsp0 -bso0 | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment