#!/bin/bash
  
  clear
  echo -e
  echo -en "\E[32;1m Converting image to 32-BYTES chunk header... \E[32;0m"
  echo -e
  echo -e
  echo -en "\033[1m Choose ext4 image for edit \033[0m"
  echo -e
  echo -e
  
  find PROJECT/ -maxdepth 1 -regex '.*\(.img\|.ext4\)' -type f -exec ls {} \;
  
  echo -e
  
  echo -en "\033[1m Input image <name>: \033[0m"
  tput sgr0
  
  read INPUT
  
  echo -e
  
  echo -en "\033[1m  Rename original $INPUT \033[0m"
  
  mv -v PROJECT/$INPUT PROJECT/$INPUT.tmp
  
  echo -e
  echo -e
  
  tools/android_img_repack_tools/sgs4ext4fs --bloat PROJECT/$INPUT.tmp PROJECT/$INPUT
  
  rm -f PROJECT/$INPUT.tmp
  
  chmod 0644 PROJECT/$INPUT
  
  echo
  echo -en "\033[1m Finished \033[0m"
  echo
  tput sgr0
  echo
  echo "Press Enter to continue"
  read enterKey

