Last active
April 28, 2022 07:36
-
-
Save FacuM/43b5ec10b7294723f91b20c682edac42 to your computer and use it in GitHub Desktop.
This is an alternative to both Migrate Flasher normal and emergency flash if they hang on your backup file. Just drop this file on the root of your /sdcard then run a shell on your device and execute "bash /sdcard/android_extract.sh <full_path_to_migrate_zip>" i.e.: "bash /sdcard/android_extract.sh /sdcard/Migrate/Full_Backup_XYZ.zip", wait for …
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
#!/system/xbin/bash | |
# This is an alternative to both Migrate Flasher normal and emergency flash if | |
# they hang on your backup file. | |
# | |
# Just drop this file on the root of your /sdcard then run a shell on your | |
# device and execute the following command: | |
# | |
# bash /sdcard/android_extract.sh <full_path_to_migrate_zip> | |
# | |
# Example: | |
# | |
# bash /sdcard/android_extract.sh /sdcard/Migrate/Full_Backup_XYZ.zip | |
# | |
# Then wait for a few minutes and you should be able to give Migrate Helper a | |
# go to finish the process. | |
BACKUP=/sdcard/backup; | |
CACHE=/data/local/tmp/migrate_cache/; | |
if [ "$(id -u)" -ne 0 ]; then | |
echo 'This script must be run as root.'; | |
exit 1; | |
fi; | |
if [ "$1" == '' ]; then | |
echo 'Usage: '; | |
echo ''; | |
echo 'bash '"$0"' source_zip'; | |
exit 1; | |
fi; | |
if [ ! -f "$1" ]; then | |
echo 'The source file provided does not exist.'; | |
exit 1; | |
fi; | |
printf '\n'; | |
for remainingTime in $(seq 3 -1 1); do | |
printf '\rRemoving old unzip in '"$remainingTime"' seconds (press CTRL-C now if unsure!)...'; | |
sleep 1; | |
done; | |
rm -rfv "$BACKUP"; | |
mkdir -p "$BACKUP"; | |
# move inside the backup unzip path | |
cd $BACKUP; | |
echo "Unzipping backup..."; | |
unzip "$1"; | |
# make cache | |
echo "Making cache..."; | |
mkdir -p $CACHE; | |
files="$(ls . | wc -l)" | |
echo "Approximate number of files: $files"; | |
echo "Copying apps..."; | |
# copy app info, apks and permission to cache | |
cp -v *.json $CACHE; | |
cp -va *.app $CACHE; | |
cp -v *.perm $CACHE; | |
# copy app data | |
cp -v *.tar.gz /data/data/; | |
# copy extras | |
echo "Copying extras..."; | |
cp -v *.calls.db $CACHE 2>/dev/null; | |
cp -v *.sms.db $CACHE 2>/dev/null; | |
cp -v *.vcf $CACHE 2>/dev/null; | |
cp -v default.kyb $CACHE 2>/dev/null; | |
cp -v screen.dpi $CACHE 2>/dev/null; | |
# copy package data | |
echo "Copying package-data..."; | |
cp -v package-data* $CACHE; | |
echo "Done! Please install Migrate Helper to continue."; | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment