#!/bin/sh
if [ $# -ne 2 ] ; then
fi
patch_dir=$1
INSTALL_DIR=$2
if [ ! -d $patch_dir ] ; then
fi
if [ ! -d $INSTALL_DIR ] ; then
fi
SRC_PATH="$INSTALL_DIR/src.$$"
>$SRC_PATH
DST_TMP="$INSTALL_DIR/tmp.$$"
>$DST_TMP
DST_PATH_TMP="$INSTALL_DIR/dstpathtmp.$$"
>$DST_PATH_TMP
DST_PATH="$INSTALL_DIR/dstpath.$$"
>$DST_PATH
DST_DIR="$INSTALL_DIR/dstdir.$$"
>$DST_DIR
FILE_NAME="$INSTALL_DIR/filename.$$"
>$FILE_NAME
PATCH_DIR=`pwd`
PATCH_DIR=$PATCH_DIR/$patch_dir
# find file name include @ or +
find "$PATCH_DIR" -name "*[\@\+]*" >"$SRC_PATH"
echo "The files under patch:"
echo "------------------------------"
cat "$SRC_PATH"
echo "------------------------------"
# include + file count
first=`grep -c "+" "$SRC_PATH"`
# without + file count
second=`grep -c -v "+" "$SRC_PATH"`
# total file count
COUNT=`expr $first + $second `
echo "There are $COUNT patchfiles !"
echo ""
LINE=1
while [ "$LINE" -le "$COUNT" ]
do
done
# / instead of +
sed 's/\+/\//g' "$DST_TMP" >>"$DST_PATH_TMP"
# . instead of @
sed 's/@/\./g' "$DST_PATH_TMP" >>"$DST_PATH"
LINE=1
while [ "$LINE" -le "$COUNT" ]
do
done
LINE=1
while [ "$LINE" -le "$COUNT" ]
do
done
rm -f "$SRC_PATH"
rm -f "$DST_TMP"
rm -f "$DST_PATH_TMP"
rm -f "$DST_PATH"
rm -f "$DST_DIR"
rm -f "$FILE_NAME"
echo "Patch has finished!"