diff options
-rwxr-xr-x | mailimport | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/mailimport b/mailimport index b563eecd9..e6e4df411 100755 --- a/mailimport +++ b/mailimport @@ -28,6 +28,10 @@ if [ "$TMPDIR" == "" ]; then TMPDIR=/tmp fi +if [ "$EDITOR" == "" ]; then + EDITOR=nano +fi + DIR=$TMPDIR/mailimport$$ mkdir $DIR if [ "$?" != "0" ]; then @@ -39,26 +43,35 @@ TMP2=$DIR/patchheader apply_patch () { next=$1 - pdir=linux - echo patch -s -t -p1 --dry-run -l -N -d $pdir -i $next - patch -s -t -p1 --dry-run -l -N -d $pdir -i $next - if [ "$?" != "0" ]; then - pdir=. + unset cont + until [ "$cont" == "0" ]; do + cont=1 + pdir=linux echo patch -s -t -p1 --dry-run -l -N -d $pdir -i $next patch -s -t -p1 --dry-run -l -N -d $pdir -i $next if [ "$?" != "0" ]; then - $head $next + pdir=. + echo patch -s -t -p1 --dry-run -l -N -d $pdir -i $next + patch -s -t -p1 --dry-run -l -N -d $pdir -i $next + fi + + if [ "$?" != "0" ]; then echo "*** ERROR: Patch didn't applied well" if [ "$exitonerror" != "" ]; then + $head $next exit - else - return fi + echo "** Edit file $next" + sleep 1 + $EDITOR $next + else + echo "Patch applied OK against $pdir" + cont=0 fi - fi + done - nano $next + $EDITOR $next unset cont until [ "$cont" == "0" ]; do @@ -68,7 +81,7 @@ apply_patch () { if [ "`grep '^Bad:' $TMP2`" != "" ]; then echo "*** ERROR: Patch bad formed. Please fix." sleep 1 - nano $next + $EDITOR $next cont=1 fi done |