File: apply.sh

package info (click to toggle)
libapache-mod-ssl 2.8.22-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,208 kB
  • ctags: 1,649
  • sloc: ansic: 13,070; sh: 3,304; lex: 190; makefile: 99; yacc: 97; perl: 11
file content (43 lines) | stat: -rwxr-xr-x 1,093 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
##
##  apply.sh -- Apply a patch
##  Copyright (c) 1998-2004 Ralf S. Engelschall, All Rights Reserved. 
##

#   parameters
cookiestr="$1"
cookiefile="$2"
patchprg="$3"
patchfile="$4"
applydir="$5"
prefix="$6"
display="$7"

if [ ".`grep $cookiestr $cookiefile`" = . ]; then
    cat $patchfile |\
    $patchprg --forward --directory $applydir 2>&1 |\
    tee config.log |\
    egrep '^.Index:' | sed -e "s/.*Index: /$prefix patching: [FILE] /" |\
    eval $display
    failed=0
    if [ ".`grep $cookiestr $cookiefile`" = . ]; then
        failed=1
    fi
    if [ ".`cd $applydir; find . -name '*.rej' -print`" != . ]; then
        failed=1
    fi
    if [ ".$failed" = .1 ]; then
        echo "Error: Application of patch failed:" 1>&2
        echo "-------------------------------------------------" 1>&2
        tail config.log 1>&2
        echo "-------------------------------------------------" 1>&2
        exit 1
    else
        rm -f config.log
    fi
else
    cat $patchfile |\
    egrep '^Index:' | sed -e "s/.*Index: /$prefix skipping: [FILE] /" |\
    eval $display
fi