readyForTarget.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. git pull
  9. #modify build date
  10. build_date="`date \"+%Y-%m-%d\"`"
  11. 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
  12. cd ../ && tar cpf ../oem_backup.tar . && cd ../
  13. date="`date \"+%Y%m%d\"`"
  14. SOFT_VERSION="`grep firmware oem/etc/speaker.conf | cut -d '=' -f2`"
  15. name="u_m2_g2_fs_v_${SOFT_VERSION}_d_${date}.img"
  16. rm -rf output/*
  17. [ ! -d output ] && mkdir output
  18. 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!"
  19. rm -rf oem_backup.tar
  20. mv speaker.conf.bak oem/etc/speaker.conf
  21. echo "The upgrade package has been generated in the output/${name}"
  22. else
  23. echo "usage:$0 branch-name"
  24. fi
  25. exit 0