source: scripts/patch/readline-patch.sh @ 2803d79

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 2803d79 was 2803d79, checked in by Jim Gifford <clfs@…>, 15 years ago

Fixes to Patch Creaters

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