Skip to content

Instantly share code, notes, and snippets.

@YHNdnzj
Created December 15, 2022 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YHNdnzj/d72be92c71e1a775adfcdd23556999d3 to your computer and use it in GitHub Desktop.
Save YHNdnzj/d72be92c71e1a775adfcdd23556999d3 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
set -o pipefail
product="$1"
(
set -x
[[ -n $product ]]
fastboot getvar product |& grep -q "$product"
)
echo
cd "$product"
mv flash_all.sh flash_all.sh.bak
tee flash_all.sh <<< "#!/bin/bash -ex"
grep "^fastboot" flash_all.sh.bak | grep -v 'getvar\|reboot' | sed -e 's/`dirname $0`\///g' -e 's#$\* ##g' | tee -a flash_all.sh
echo
read -rp "Continue? [y/N] "
if [[ ${REPLY,,} =~ ^(y|yes)$ ]]; then
chmod +x flash_all.sh
exec ./flash_all.sh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment