source: scripts/patch/bash-patch.sh@ 5c7a2eb

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5c7a2eb was 9676bac, checked in by Jim Gifford <clfs@…>, 16 years ago

Added Perl Patch and cleaned up

  • Property mode set to 100755
File size: 3.1 KB
RevLine 
[06dcdf6]1#!/bin/bash
2# Create a Bash Patch
3
4# Get Version #
5#
6VERSION=$1
7
8# Check Input
9#
10if [ "${VERSION}" = "" ]; then
[9676bac]11 echo "$0 - Bash_Version"
12 echo "This will Create a Patch for Bash Bash_Version"
13 exit 255
[06dcdf6]14fi
15
16# Get the # of Patches
17#
18cd /usr/src
19wget ftp://ftp.cwru.edu/pub/bash/bash-${VERSION}-patches/ --no-remove-listing
20VERSION2=$(echo ${VERSION} | sed -e 's/\.//g')
21FILES=$(cat index.html | grep "${VERSION2}" | cut -f2 -d'"' | cut -f4 -d. | cut -f3 -d- | tail -n 1)
22rm -f .listing
23rm -f index.html
24SKIPPATCH=""
25SKIPPED=""
26
27# Download BASH Source
28#
29if ! [ -e bash-${VERSION}.tar.gz ]; then
[9676bac]30 wget ftp://ftp.cwru.edu/pub/bash/bash-${VERSION}.tar.gz
[06dcdf6]31fi
32
33# Cleanup Directory
34#
35rm -rf bash-${VERSION} bash-${VERSION}.orig
36tar xvf bash-${VERSION}.tar.gz
37cp -ar bash-${VERSION} bash-${VERSION}.orig
38cd bash-${VERSION}
39CURRENTDIR=$(pwd -P)
40
41# Download and Apply Patches
42#
43PATCHURL=ftp://ftp.cwru.edu/pub/bash/bash-${VERSION}-patches
44mkdir /tmp/bash-${VERSION}
45COUNT=1
46while [ ${COUNT} -le ${FILES} ]; do
[9676bac]47 cd /tmp/bash-${VERSION}
48 DLCOUNT="${COUNT}"
49 SKIPME=no
50 if [ "${COUNT}" -lt "100" ]; then
51 DLCOUNT="0${COUNT}"
52 fi
53 if [ "${COUNT}" -lt "10" ]; then
54 DLCOUNT="00${COUNT}"
55 fi
56 for skip in ${SKIPPATCH} ; do
57 if [ "${DLCOUNT}" = "$skip" ]; then
58 echo "Patch bash${VERSION2}-${DLCOUNT} skipped"
59 SKIPPED="${SKIPPED} ${DLCOUNT}"
60 SKIPME=yes
61 fi
62 done
63 if [ "${SKIPME}" != "yes" ]; then
64 if ! [ -e ${VERSION}.${DLCOUNT} ]; then
65 wget --quiet ${PATCHURL}/bash${VERSION2}-${DLCOUNT}
66 fi
67 cd ${CURRENTDIR}
68 patch --dry-run -s -f -Np0 -i /tmp/bash-${VERSION}/bash${VERSION2}-${DLCOUNT}
69 if [ "$?" = "0" ]; then
70 echo "Patch bash${VERSION2}-${DLCOUNT} applied"
71 patch -s -Np0 -i /tmp/bash-${VERSION}/bash${VERSION2}-${DLCOUNT}
72 else
73 echo "Patch bash${VERSION2}-${DLCOUNT} not applied"
74 rm -f /tmp/bash-${VERSION}/bash${VERSION2}-${DLCOUNT}
75 SKIPPED="${SKIPPED} ${DLCOUNT}"
76 fi
77 fi
78 COUNT=`expr ${COUNT} + 1`
[06dcdf6]79done
80
81# Cleanup Directory
82#
[d57287f4]83
[c0d5090]84for dir in $(find * -type d); do
[9676bac]85 cd /usr/src/bash-${VERSION}/${dir}
86 for file in $(find . -name '*~'); do
87 rm -f ${file}
88 done
89 for file in $(find . -name '*.orig'); do
90 rm -f ${file}
91 done
[06dcdf6]92done
[e91eb56]93cd /usr/src/bash-${VERSION}
[2803d79]94rm -f *~ *.orig
[06dcdf6]95
96# Create Patch
97#
98cd /usr/src
[c0d5090]99echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > bash-${VERSION}-branch_update-x.patch
100echo "Date: `date +%m-%d-%Y`" >> bash-${VERSION}-branch_update-x.patch
101echo "Initial Package Version: ${VERSION}" >> bash-${VERSION}-branch_update-x.patch
102echo "Origin: Upstream" >> bash-${VERSION}-branch_update-x.patch
103echo "Upstream Status: Applied" >> bash-${VERSION}-branch_update-x.patch
104echo "Description: Contains all upstream patches up to ${VERSION}-${FILES}" >> bash-${VERSION}-branch_update-x.patch
[06dcdf6]105if [ -n "${SKIPPED}" ]; then
[9676bac]106 echo " The following patches were skipped" >> bash-${VERSION}-branch_update-x.patch
107 echo " ${SKIPPED}" >> bash-${VERSION}-branch_update-x.patch
[06dcdf6]108fi
[c0d5090]109echo "" >> bash-${VERSION}-branch_update-x.patch
110diff -Naur bash-${VERSION}.orig bash-${VERSION} >> bash-${VERSION}-branch_update-x.patch
111echo "Created /usr/src/bash-${VERSION}-branch_update-x.patch."
Note: See TracBrowser for help on using the repository browser.