clfs-1.2
clfs-2.1
clfs-3.0.0-systemd
clfs-3.0.0-sysvinit
systemd
sysvinit
Last change
on this file since 0ee931e was 617118d, checked in by Jim Gifford <clfs@…>, 19 years ago |
r561@server (orig r559): root | 2005-06-05 02:38:49 -0700
Fixed Directory Structure
|
-
Property mode
set to
100755
|
File size:
1.6 KB
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # Patching functions for cross-lfs
|
---|
4 | # ---------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | # Check for stuff
|
---|
12 | #----------------
|
---|
13 |
|
---|
14 | # Check for a grep which takes -E
|
---|
15 | for dir in "" /bin/ /usr/bin/ /usr/xpg4/bin/ /usr/local/bin/ ; do
|
---|
16 | echo X | ${dir}grep -E X > /dev/null 2>&1 &&
|
---|
17 | {
|
---|
18 | export GREP="${path}grep"
|
---|
19 | break
|
---|
20 | }
|
---|
21 | done
|
---|
22 |
|
---|
23 | if [ "${GREP}" = "" ]; then
|
---|
24 | echo "install a grep on the system that handles -E"
|
---|
25 | exit 1
|
---|
26 | fi
|
---|
27 |
|
---|
28 | apply_patch () { # ${1}=<package-${PATCH_VER}> ${2}= patch flag (defaults to -Np1)
|
---|
29 | local patchname=${1}
|
---|
30 | local patchflags=${2}
|
---|
31 |
|
---|
32 | local patch=`ls -t ${PATCHES}/${patchname}.* 2> /dev/null | \
|
---|
33 | ${GREP} -E ${patchname}.\(patch\|patch.gz\|patch.bz2\)$ | head -n 1`
|
---|
34 |
|
---|
35 |
|
---|
36 | test -e ${PATCHES}/${patchname} ||
|
---|
37 | test -z ${patch} &&
|
---|
38 | {
|
---|
39 | echo "apply_patch: unable to locate patch '${patchname}' in ${PATCHES} ... exiting"
|
---|
40 | exit 1
|
---|
41 | }
|
---|
42 |
|
---|
43 | test -z ${patchflags} && patchflags='-Np1'
|
---|
44 |
|
---|
45 | case ${patch} in
|
---|
46 | *.patch.gz ) local CAT="gzip -dc" ;;
|
---|
47 | *.patch.bz2 ) local CAT="bzcat" ;;
|
---|
48 | *.patch ) local CAT="cat" ;;
|
---|
49 | * ) echo "apply_patch: unable to determine patch type... exiting"
|
---|
50 | exit 1 ;;
|
---|
51 | esac
|
---|
52 |
|
---|
53 | echo "Applying ${patch}"
|
---|
54 |
|
---|
55 | ${CAT} ${patch} | patch ${patchflags} 2> /dev/null
|
---|
56 |
|
---|
57 | # PIPESTATUS not available under bash 1.14.7 (RH 6.2)
|
---|
58 | #if [ "${PIPESTATUS[*]}" = "0 0" ]
|
---|
59 | if [ 0 = "${?}" ]; then
|
---|
60 | echo " o ${patch} applied successfully"
|
---|
61 | else
|
---|
62 | echo "apply_patch: unable to apply patch ${patch}... exiting"
|
---|
63 | exit 1
|
---|
64 | fi
|
---|
65 | }
|
---|
66 |
|
---|
67 | # Export functions
|
---|
68 | export -f apply_patch
|
---|
69 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.