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

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

Updates to Patch Scripts

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