readyForTarget.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. rm -rf output/${name}
  16. [ ! -d output ] && mkdir output
  17. tar -zcf output/${name} oem_backup.tar etc usr www app && echo "Wirte Sign..." && /bin/rk_generate output/${name} G2-DIA-CDD2 ${SOFT_VERSION} && echo "Wirte Sign complete!"
  18. rm -rf oem_backup.tar
  19. mv speaker.conf.bak oem/etc/speaker.conf
  20. echo "The upgrade package has been generated in the output/${name}"
  21. else
  22. echo "usage:$0 branch-name"
  23. fi
  24. exit 0