Created
May 22, 2020 15:18
-
-
Save ShivamKumarJha/66ba6024beeb5b14dfce189826d3b129 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
[[ -z "$1" ]] && exit 1 | |
ATDIR="/Users/shivam/android_tools" | |
cd ${ATDIR} | |
mkdir -p "$ATDIR/input" | |
# Reset to origin/HEAD | |
BNAME="$(git symbolic-ref HEAD 2>/dev/null)" | |
BNAME=${BNAME##refs/heads/} | |
REMOTE="$(git remote | head -n 1)" | |
git fetch "$REMOTE" "$BNAME" | |
git reset --hard "$REMOTE"/"$BNAME" | |
export DUMMYDT=y | |
export DUMPYARA=n | |
export ORGMEMBER=y | |
export VERBOSE=y | |
for var in "$@"; do | |
if [[ "$var" == *"https://github.com/"* ]]; then | |
URL="$var" | |
FILE=${URL##*/} | |
EXTENSION=${URL##*.} | |
UNZIP_DIR=${FILE/.$EXTENSION/} | |
echo "Downloading file" | |
aria2c -x 16 ${URL} -d ${ATDIR}/input -o ${FILE} | |
echo "Extracting file" | |
7z x -y "$ATDIR/input/$FILE" -o"$ATDIR/dumps/$UNZIP_DIR" > /dev/null 2>&1 | |
DUMP_DIR="$(dirname "$(find ${ATDIR}/dumps/${UNZIP_DIR} -type f -name "all_files.txt" | head -1)")" | |
bash "$ATDIR/tools/dummy_dt.sh" "$DUMP_DIR" | |
else | |
bash "$ATDIR/tools/rom_extract.sh" "$(echo ${var} | sed "s|bigota.d.miui.com|hugeota.d.miui.com|g" )" | |
fi | |
done | |
rm -rf "$ATDIR/dummy_dt" "$ATDIR/dumps" "$ATDIR/input" "$ATDIR/kernel" "$ATDIR/vendor" "$ATDIR/working" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment