source: scripts/patch/readline-patch.sh@ 3084543

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

Figure out what the last patch # is and grab the next #

  • Property mode set to 100755
File size: 3.8 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
[c7ef534]33# Set Patch Number
34#
35cd /usr/src
36wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
37PATCH_NUM=$(cat index.html | grep readline | grep "${VERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
38PATCH_NUM=$(expr ${PATCH_NUM} + 1)
39rm -f index.html
40
[06dcdf6]41# Cleanup Directory
42#
43rm -rf readline-${VERSION} readline-${VERSION}.orig
44tar xvf readline-${VERSION}.tar.gz
45cp -ar readline-${VERSION} readline-${VERSION}.orig
46cd readline-${VERSION}
47CURRENTDIR=$(pwd -P)
48
49# Download and Apply Patches
50#
51PATCHURL=ftp://ftp.cwru.edu/pub/bash/readline-${VERSION}-patches
52mkdir /tmp/readline-${VERSION}
53COUNT=1
54while [ ${COUNT} -le ${FILES} ]; do
[9676bac]55 cd /tmp/readline-${VERSION}
56 DLCOUNT="${COUNT}"
57 SKIPME=no
58 if [ "${COUNT}" -lt "100" ]; then
59 DLCOUNT="0${COUNT}"
60 fi
61 if [ "${COUNT}" -lt "10" ]; then
62 DLCOUNT="00${COUNT}"
63 fi
64 for skip in ${SKIPPATCH} ; do
65 if [ "${DLCOUNT}" = "$skip" ]; then
66 echo "Patch readline${VERSION2}-${DLCOUNT} skipped"
67 SKIPPED="${SKIPPED} ${DLCOUNT}"
68 SKIPME=yes
69 fi
70 done
71 if [ "${SKIPME}" != "yes" ]; then
72 if ! [ -e ${VERSION}.${DLCOUNT} ]; then
73 wget --quiet ${PATCHURL}/readline${VERSION2}-${DLCOUNT}
74 fi
75 cd ${CURRENTDIR}
76 patch --dry-run -s -f -Np0 -i /tmp/readline-${VERSION}/readline${VERSION2}-${DLCOUNT}
77 if [ "$?" = "0" ]; then
78 echo "Patch readline${VERSION2}-${DLCOUNT} applied"
79 patch -s -Np0 -i /tmp/readline-${VERSION}/readline${VERSION2}-${DLCOUNT}
80 else
81 echo "Patch readline${VERSION2}-${DLCOUNT} not applied"
82 rm -f /tmp/readline-${VERSION}/readline${VERSION2}-${DLCOUNT}
83 SKIPPED="${SKIPPED} ${DLCOUNT}"
84 fi
85 fi
86 COUNT=`expr ${COUNT} + 1`
[06dcdf6]87done
88
89# Cleanup Directory
90#
[c0d5090]91# Cleanup Directory
92#
93for dir in $(find * -type d); do
[9676bac]94 cd /usr/src/readline-${VERSION}/${dir}
95 for file in $(find . -name '*~'); do
96 rm -f ${file}
97 done
98 for file in $(find . -name '*.orig'); do
99 rm -f ${file}
100 done
[06dcdf6]101done
[e91eb56]102cd /usr/src/readline-${VERSION}
[2803d79]103rm -f *~ *.orig
[06dcdf6]104
105# Create Patch
106#
107cd /usr/src
[c7ef534]108echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > readline-${VERSION}-branch_update-${PATCH_NUM}.patch
109echo "Date: `date +%m-%d-%Y`" >> readline-${VERSION}-branch_update-${PATCH_NUM}.patch
110echo "Initial Package Version: ${VERSION}" >> readline-${VERSION}-branch_update-${PATCH_NUM}.patch
111echo "Origin: Upstream" >> readline-${VERSION}-branch_update-${PATCH_NUM}.patch
112echo "Upstream Status: Applied" >> readline-${VERSION}-branch_update-${PATCH_NUM}.patch
113echo "Description: Contains all upstream patches up to ${VERSION}-${FILES}" >> readline-${VERSION}-branch_update-${PATCH_NUM}.patch
[06dcdf6]114if [ -n "${SKIPPED}" ]; then
[c7ef534]115 echo " Thee following patches were skipped" >> readline-${VERSION}-branch_update-${PATCH_NUM}.patch
116 echo " ${SKIPPED}" >> readline-${VERSION}-branch_update-${PATCH_NUM}.patch
[06dcdf6]117fi
[c7ef534]118echo "" >> readline-${VERSION}-branch_update-${PATCH_NUM}.patch
119diff -Naur readline-${VERSION}.orig readline-${VERSION} >> readline-${VERSION}-branch_update-${PATCH_NUM}.patch
120echo "Created /usr/src/readline-${VERSION}-branch_update-${PATCH_NUM}.patch."
Note: See TracBrowser for help on using the repository browser.