readyForTarget.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #! /bin/bash
  2. if [ $# = 1 ];then
  3. branch_name=$1
  4. if [ "foo${branch_name}" != "foomain" ];then
  5. echo "Branch name not found!"
  6. exit 0
  7. fi
  8. #modify build date
  9. build_date="`date \"+%Y-%m-%d\"`"
  10. cd oem/etc && awk -v new_date="$build_date" '/^\[upgrade\]/{f=1} f==1 && /^date=/{sub(/=.*/, "=" new_date); f=0} 1' speaker.conf > temp.conf && mv speaker.conf ../../speaker.conf.bak && mv temp.conf speaker.conf
  11. cd ../ && tar cpf ../oem_backup.tar . && cd ../
  12. date="`date \"+%Y%m%d\"`"
  13. SOFT_VERSION="`grep firmware oem/etc/speaker.conf | cut -d '=' -f2`"
  14. name="u_m2_g2_fs_v_${SOFT_VERSION}_d_${date}.img"
  15. [ ! -d output ] && mkdir output
  16. tar -zcf output/${name} oem_backup.tar etc oem usr www app && echo "Wirte Sign..." && /bin/rk_generate output/${name} G2-DIA ${SOFT_VERSION} && echo "Wirte Sign complete!"
  17. rm -rf oem_backup.tar
  18. mv speaker.conf.bak oem/etc/speaker.conf
  19. echo "The upgrade package has been generated in the output/${name}"
  20. else
  21. echo "usage:$0 branch-name"
  22. fi
  23. exit 0