1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #!/bin/bash
- CURRENT_DIR=$(pwd)
- if [[ $1 == '-h' || ! -n $1 || ! -n $2 || ! -n $3 ]]; then
- echo "help"
- echo "'./makepack <pac_name> <ver_base> <ver_cur> to make one pack file"
- echo "'./makepack <pac_name> <ver_base> <ver_cur> all' to make all pack files"
- echo "pac_name:pac file name that need to be pack"
- echo "ver_base:the base version of the pac file"
- echo "ver_cur:the current version of the pac file"
- exit
- fi
- #判断基本文件是否存在
- CORE_SDK_TOOLS_DIR=../../core_sdk
- XMLFILE=$CURRENT_DIR/$CORE_SDK_TOOLS_DIR/tools/linux/setting/fota8910_apping_flash_5700.xml
- EXEFILE=$CURRENT_DIR/$CORE_SDK_TOOLS_DIR/tools/linux/dtools
- OPTIONFLAG=--pac8910
- if [ ! -f "$XMLFILE" ]; then
- echo "$XMLFILE not found"
- exit
- fi
- if [ ! -f "$EXEFILE" ]; then
- echo "$EXEFILE not found"
- exit
- fi
- if [[ $4 != 'all' ]]; then
- #只生成一个差分包
- SRCFILE1=$CURRENT_DIR/out/$1_V$2.pac
- SRCFILE2=$CURRENT_DIR/out/$1_V$3.pac
- DESFILE=$CURRENT_DIR/out/$1_V$2$3.pack
- if [ ! -f "$SRCFILE1" ]; then
- echo "$SRCFILE1 not found"
- exit
- fi
- if [ ! -f "$SRCFILE2" ]; then
- echo "$SRCFILE2 not found"
- exit
- fi
- $EXEFILE fotacreate2 --pac $SRCFILE1,$SRCFILE2,$XMLFILE $DESFILE
- echo pack one done
- else
- #生成所有差分包
- #先判断是否有文件不存在
- for((i=$2;i<$3;i++));
- do
- SRCFILE=$CURRENT_DIR/out/$1_V$i.pac
- if [ ! -f "$SRCFILE" ]; then
- echo "$SRCFILE not found"
- exit
- fi
- done
- #文件都存在了,则可以生成差分包了
- for((i=$2;i<$3;i++));
- do
- SRCFILE1=$CURRENT_DIR/out/$1_V$i.pac
- SRCFILE2=$CURRENT_DIR/out/$1_V$3.pac
- DESFILE=$CURRENT_DIR/out/$1_V$i$3.pack
- $EXEFILE fotacreate2 --pac $SRCFILE1,$SRCFILE2,$XMLFILE $DESFILE
- done
- echo pack all done
- fi
- echo exit
|