#!/bin/bash CURRENT_DIR=$(pwd) if [[ $1 == '-h' || ! -n $1 || ! -n $2 || ! -n $3 || ! -n $4 ]]; then echo "help" echo "'./makepack to make one pack file" echo "'./makepack 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" echo "cust_code:the custome type 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 if [ ! -f "$XMLFILE" ]; then echo "$XMLFILE not found" exit fi if [ ! -f "$EXEFILE" ]; then echo "$EXEFILE not found" exit fi if [[ $5 != 'all' ]]; then #只生成一个差分包 SRCFILE1=$CURRENT_DIR/out/$1_$4_$2.pac SRCFILE2=$CURRENT_DIR/out/$1_$4_$3.pac DESFILE=$CURRENT_DIR/out/$1_$4_$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_$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_$i.pac SRCFILE2=$CURRENT_DIR/out/$1_$3.pac DESFILE=$CURRENT_DIR/out/$1_$i$3.pack $EXEFILE fotacreate2 --pac $SRCFILE1,$SRCFILE2,$XMLFILE $DESFILE done echo pack all done fi echo exit