File: android-deltas-sync/_etc/bash-version/initial-copy-part2-phone.sh
################################################################# # Initial Copy, Part 2: run on PHONE, in Termux or other, with: # # bash initial-copy-part2-phone.sh # # Run this from any folder; it uses paths set in config-phone.txt, # and finds sourced files in its own folder automatically. # # Step runtimes are shown in the console after step completion. # Step outputs go to files in $L; watch with 'tail -f $L/file'. # # Caveat: this script requires space for both content and its # uncompressed zip on the phone - essentially twice the size # of content. If space is tight, manually copy content from # proxy to phone, using an Android file explorer. # # See _README.html for license, attribution, and more docs. ################################################################# mydir=$(dirname "$0") # this script's own folder source $mydir/config-phone.txt # get settings for scripts run on phone source $mydir/common.sh # run code common to both PC and phone #---------------------------------------------------------------- # 1) Copy content zip from proxy to phone with an explorer app #---------------------------------------------------------------- # Choose your app (but not Termux: POSIX cannot access USB in 11) echo "Manually copy or move $STUFF.zip" echo " from the root of the USB drive" echo " to $F" echo 'using any Android file-explorer app with suitable storage permissions.' read -p 'Press enter/return here when the copy is finished...' # did the copy work? if [ ! -e $F/$STUFF.zip ]; then echo 'Content zip not found; please rerun this script to try again.' exit fi #---------------------------------------------------------------- # 2) Unzip content on phone with [zip-extract.py] in Termux #---------------------------------------------------------------- announce 'Unzipping content on phone' if [ -e $T/$STUFF ]; then echo 'Removing prior content on phone' time rm -rf $T/$STUFF echo 'Starting unzip' fi time python3 $Z/zip-extract.py $F/$STUFF.zip $T -permissions \ > $L/$stamp--init-1-unzip-log.txt #---------------------------------------------------------------- # 3) Cleanup content zip on phone in Termux #---------------------------------------------------------------- # on-phone zip; user may have copied or moved the proxy zip, but can't check here printf '\nRemoving content zip from phone (remove manually from proxy as needed)\n' time rm -f $F/$STUFF.zip #---------------------------------------------------------------- # Configurable: hook for custom post-propagate steps #---------------------------------------------------------------- bash $mydir/z-postcopy-hook-phone.sh printf "\nFinished: see logs in $L.\n"