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

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 2606272 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
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#
[d8a9d8b]18cd ~/tmp
[06dcdf6]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
[10b98b1]27# Download Readline Source
[06dcdf6]28#
[d8a9d8b]29cd ~/tmp
[06dcdf6]30if ! [ -e readline-${VERSION}.tar.gz ]; then
[9676bac]31 wget ftp://ftp.cwru.edu/pub/bash/readline-${VERSION}.tar.gz
[06dcdf6]32fi
33
[c7ef534]34# Set Patch Number
35#
[d8a9d8b]36cd ~/tmp
[c7ef534]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
[06dcdf6]42# Cleanup Directory
43#
[d8a9d8b]44cd ~/tmp
[06dcdf6]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#
[d8a9d8b]51install -d ~/tmp/readline-${VERSION}-patches
52cd ~/tmp/readline-${VERSION}
53CURRENTDIR=$(pwd -P)
[06dcdf6]54PATCHURL=ftp://ftp.cwru.edu/pub/bash/readline-${VERSION}-patches
55mkdir /tmp/readline-${VERSION}
56COUNT=1
57while [ ${COUNT} -le ${FILES} ]; do
[d8a9d8b]58 cd ~/tmp/readline-${VERSION}
[9676bac]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
[d8a9d8b]76 cd ~/tmp/readline-${VERSION}-patches
[9676bac]77 wget --quiet ${PATCHURL}/readline${VERSION2}-${DLCOUNT}
78 fi
79 cd ${CURRENTDIR}
[d8a9d8b]80 patch --dry-run -s -f -Np0 -i ~/tmp/readline-${VERSION}-patches/readline${VERSION2}-${DLCOUNT}
[9676bac]81 if [ "$?" = "0" ]; then
82 echo "Patch readline${VERSION2}-${DLCOUNT} applied"
[d8a9d8b]83 patch -s -Np0 -i ~/tmp/readline-${VERSION}-patches/readline${VERSION2}-${DLCOUNT}
[9676bac]84 else
85 echo "Patch readline${VERSION2}-${DLCOUNT} not applied"
[d8a9d8b]86 rm -f ~/tmp/readline-${VERSION}-patches/readline${VERSION2}-${DLCOUNT}
[9676bac]87 SKIPPED="${SKIPPED} ${DLCOUNT}"
88 fi
89 fi
90 COUNT=`expr ${COUNT} + 1`
[06dcdf6]91done
92
93# Cleanup Directory
94#
[c0d5090]95# Cleanup Directory
96#
97for dir in $(find * -type d); do
[d8a9d8b]98 cd ~/tmp/readline-${VERSION}/${dir}
[9676bac]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
[06dcdf6]105done
[d8a9d8b]106cd ~/tmp/readline-${VERSION}
[2803d79]107rm -f *~ *.orig
[06dcdf6]108
109# Create Patch
110#
[d8a9d8b]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
[06dcdf6]118if [ -n "${SKIPPED}" ]; then
[d8a9d8b]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
[06dcdf6]121fi
[d8a9d8b]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.