3 [ "$1" = "-h" -o "$1" = "--help" ] && echo "usage: $PROG [patch dir]" && exit 0
4 [ "$1" = "-d" ] && shift && DELETE="git rm" || DELETE="echo"
5 [ "$1" = "-v" ] && shift && VERBOSE="echo" || VERBOSE=":"
7 [ "$1" ] && BASEDIR="$1"
8 BASEDIR=${BASEDIR:-lustre/kernel_patches}
9 SERIESPATH=${SERIESPATH:-$BASEDIR/series}
10 PATCHPATH=${PATCHPATH:-$BASEDIR/patches}
12 [ ! -d "$BASEDIR" ] && echo "$PROG: missing base directory '$BASEDIR'" && exit 1
13 [ ! -d "$SERIESPATH" ] && echo "$PROG: missing series '$SERIESPATH'" && exit 2
14 [ ! -d "$PATCHPATH" ] && echo "$PROG: missing patches '$PATCHPATH'" && exit 3
16 for PATCH in $(ls $PATCHPATH | egrep -v "CVS|~$|.orig|.rej"); do
18 if ! grep -q $PATCH $SERIESPATH/*.series ; then
19 $DELETE $PATCHPATH/$PATCH