makepack 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. CURRENT_DIR=$(pwd)
  3. if [[ $1 == '-h' || ! -n $1 || ! -n $2 || ! -n $3 ]]; then
  4. echo "help"
  5. echo "'./makepack <pac_name> <ver_base> <ver_cur> to make one pack file"
  6. echo "'./makepack <pac_name> <ver_base> <ver_cur> all' to make all pack files"
  7. echo "pac_name:pac file name that need to be pack"
  8. echo "ver_base:the base version of the pac file"
  9. echo "ver_cur:the current version of the pac file"
  10. exit
  11. fi
  12. #判断基本文件是否存在
  13. CORE_SDK_TOOLS_DIR=../../core_sdk
  14. XMLFILE=$CURRENT_DIR/$CORE_SDK_TOOLS_DIR/tools/linux/setting/fota8910_apping_flash_5700.xml
  15. EXEFILE=$CURRENT_DIR/$CORE_SDK_TOOLS_DIR/tools/linux/dtools
  16. OPTIONFLAG=--pac8910
  17. if [ ! -f "$XMLFILE" ]; then
  18. echo "$XMLFILE not found"
  19. exit
  20. fi
  21. if [ ! -f "$EXEFILE" ]; then
  22. echo "$EXEFILE not found"
  23. exit
  24. fi
  25. if [[ $4 != 'all' ]]; then
  26. #只生成一个差分包
  27. SRCFILE1=$CURRENT_DIR/out/$1_V$2.pac
  28. SRCFILE2=$CURRENT_DIR/out/$1_V$3.pac
  29. DESFILE=$CURRENT_DIR/out/$1_V$2$3.pack
  30. if [ ! -f "$SRCFILE1" ]; then
  31. echo "$SRCFILE1 not found"
  32. exit
  33. fi
  34. if [ ! -f "$SRCFILE2" ]; then
  35. echo "$SRCFILE2 not found"
  36. exit
  37. fi
  38. $EXEFILE fotacreate2 --pac $SRCFILE1,$SRCFILE2,$XMLFILE $DESFILE
  39. echo pack one done
  40. else
  41. #生成所有差分包
  42. #先判断是否有文件不存在
  43. for((i=$2;i<$3;i++));
  44. do
  45. SRCFILE=$CURRENT_DIR/out/$1_V$i.pac
  46. if [ ! -f "$SRCFILE" ]; then
  47. echo "$SRCFILE not found"
  48. exit
  49. fi
  50. done
  51. #文件都存在了,则可以生成差分包了
  52. for((i=$2;i<$3;i++));
  53. do
  54. SRCFILE1=$CURRENT_DIR/out/$1_V$i.pac
  55. SRCFILE2=$CURRENT_DIR/out/$1_V$3.pac
  56. DESFILE=$CURRENT_DIR/out/$1_V$i$3.pack
  57. $EXEFILE fotacreate2 --pac $SRCFILE1,$SRCFILE2,$XMLFILE $DESFILE
  58. done
  59. echo pack all done
  60. fi
  61. echo exit