#!/bin/bash
|
# Description: This shell script used to generate patch file
|
# Author: guowenxue <guowenxue@gmail.com>
|
# Version: 1.0.0
|
|
PROJ_PATH=`pwd`
|
|
PATCH_PATH=${PROJ_PATH}/patches
|
|
BOARD=imx6ull
|
PATCH_SUFFIX=${BOARD}.patch
|
|
set -e
|
|
|
if [ $# != 1 ] ; then
|
echo "Usage: $0 [src_path]"
|
printf "\nExample: \n"
|
echo "$0 lvgl-8.0.2"
|
|
exit ;
|
fi
|
|
|
SRC=`basename $1`
|
|
if [ ! -d ${SRC} ] ; then
|
printf "\nERROR: ${SRC} source code not exist, exit now\n\n"
|
exit
|
fi
|
|
if [ ! -f ${SRC}.tar.gz ] ; then
|
printf "\nERROR: ${SRC}.tar.gz packet not exist, exit now\n\n"
|
exit
|
fi
|
|
rm -rf ${SRC}/build
|
|
# rename new source code
|
mv ${SRC} ${SRC}-${BOARD}
|
|
# decompress orignal soruce code packet
|
tar -xzf ${SRC}.tar.gz
|
|
set +e
|
|
# generate patch file
|
diff -Nuar ${SRC} ${SRC}-${BOARD} > ${SRC}-${PATCH_SUFFIX}
|
|
# remove orignal soruce code
|
rm -rf ${SRC}
|
|
# recover new source code
|
mv ${SRC}-${BOARD} ${SRC}
|