source: scripts/patch/readline-patch.sh@ 5f4a45c9

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5f4a45c9 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.3 KB
RevLine 
[06dcdf6]1#!/bin/bash
2# Create a Readline Patch
3
4# Get Version #
5#
6VERSION=$1
7
8# Check Input
9#
10if [ "${VERSION}" = "" ]; then
[9676bac]11 echo "$0 - Readline_Version"
12 echo "This will Create a Patch for Readline Readline_Version"
13 exit 255
[06dcdf6]14fi
15
16# Get the # of Patches
17#
18cd /usr/src
19wget ftp://ftp.cwru.edu/pub/bash/readline-${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 readline-${VERSION}.tar.gz ]; then
[9676bac]30 wget ftp://ftp.cwru.edu/pub/bash/readline-${VERSION}.tar.gz
[06dcdf6]31fi
32
33# Cleanup Directory
34#
35rm -rf readline-${VERSION} readline-${VERSION}.orig
36tar xvf readline-${VERSION}.tar.gz
37cp -ar readline-${VERSION} readline-${VERSION}.orig
38cd readline-${VERSION}
39CURRENTDIR=$(pwd -P)
40
41# Download and Apply Patches
42#
43PATCHURL=ftp://ftp.cwru.edu/pub/bash/readline-${VERSION}-patches
44mkdir /tmp/readline-${VERSION}
45COUNT=1
46while [ ${COUNT} -le ${FILES} ]; do
[9676bac]47 cd /tmp/readline-${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 readline${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}/readline${VERSION2}-${DLCOUNT}
66 fi
67 cd ${CURRENTDIR}
68 patch --dry-run -s -f -Np0 -i /tmp/readline-${VERSION}/readline${VERSION2}-${DLCOUNT}
69 if [ "$?" = "0" ]; then
70 echo "Patch readline${VERSION2}-${DLCOUNT} applied"
71 patch -s -Np0 -i /tmp/readline-${VERSION}/readline${VERSION2}-${DLCOUNT}
72 else
73 echo "Patch readline${VERSION2}-${DLCOUNT} not applied"
74 rm -f /tmp/readline-${VERSION}/readline${VERSION2}-${DLCOUNT}
75 SKIPPED="${SKIPPED} ${DLCOUNT}"
76 fi
77 fi
78 COUNT=`expr ${COUNT} + 1`
[06dcdf6]79done
80
81# Cleanup Directory
82#
[c0d5090]83# Cleanup Directory
84#
85for dir in $(find * -type d); do
[9676bac]86 cd /usr/src/readline-${VERSION}/${dir}
87 for file in $(find . -name '*~'); do
88 rm -f ${file}
89 done
90 for file in $(find . -name '*.orig'); do
91 rm -f ${file}
92 done
[06dcdf6]93done
[e91eb56]94cd /usr/src/readline-${VERSION}
[2803d79]95rm -f *~ *.orig
[06dcdf6]96
97# Create Patch
98#
99cd /usr/src
[c0d5090]100echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > readline-${VERSION}-branch_update-x.patch
101echo "Date: `date +%m-%d-%Y`" >> readline-${VERSION}-branch_update-x.patch
102echo "Initial Package Version: ${VERSION}" >> readline-${VERSION}-branch_update-x.patch
103echo "Origin: Upstream" >> readline-${VERSION}-branch_update-x.patch
104echo "Upstream Status: Applied" >> readline-${VERSION}-branch_update-x.patch
105echo "Description: Contains all upstream patches up to ${VERSION}-${FILES}" >> readline-${VERSION}-branch_update-x.patch
[06dcdf6]106if [ -n "${SKIPPED}" ]; then
[9676bac]107 echo " Thee following patches were skipped" >> readline-${VERSION}-branch_update-x.patch
108 echo " ${SKIPPED}" >> readline-${VERSION}-branch_update-x.patch
[06dcdf6]109fi
[c0d5090]110echo "" >> readline-${VERSION}-branch_update-x.patch
111diff -Naur readline-${VERSION}.orig readline-${VERSION} >> readline-${VERSION}-branch_update-x.patch
112echo "Created /usr/src/readline-${VERSION}-branch_update-x.patch."
Note: See TracBrowser for help on using the repository browser.