source: scripts/patch/ncurses-patch.sh@ 0c509a2

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 0c509a2 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.6 KB
RevLine 
[06dcdf6]1#!/bin/bash
2# Create a Ncuruses Patch
3
4# Get Version #
5#
6VERSION=$1
7
8# Check Input
9#
10if [ "${VERSION}" = "" ]; then
[9676bac]11 echo "$0 - Ncurses_Version"
12 echo "This will Create a Patch for Ncurses Ncurses_Version"
13 exit 255
[06dcdf6]14fi
15
16# Get Patch Names
17#
18cd /usr/src
19wget ftp://invisible-island.net/ncurses/${VERSION}/ --no-remove-listing
20ROLLUP=$(cat index.html | grep bz2 | cut -f2 -d'>' | cut -f1 -d'<' | tail -n 1)
21ROLLPATCH=$(echo ${ROLLUP} | cut -f3 -d-)
22FILES=$(cat index.html | grep ${VERSION}-2 | grep patch.gz | cut -f2 -d'>' | cut -f1 -d'<')
23rm -f .listing
24rm -f index.html
25
26# Download Ncurses Source
27#
28if ! [ -e ncurses-${VERSION}.tar.gz ]; then
[9676bac]29 wget ftp://invisible-island.net/ncurses/ncurses-${VERSION}.tar.gz
[06dcdf6]30fi
31
[c7ef534]32# Set Patch Number
33#
34cd /usr/src
35wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
36PATCH_NUM=$(cat index.html | grep ncurses | grep "${VERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
37PATCH_NUM=$(expr ${PATCH_NUM} + 1)
38rm -f index.html
39
[06dcdf6]40# Cleanup Directory
41#
42rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig
43tar xvf ncurses-${VERSION}.tar.gz
44cp -ar ncurses-${VERSION} ncurses-${VERSION}.orig
45cd ncurses-${VERSION}
46
47# Download and Apply Rollup Patch
48#
49CURRENTDIR=$(pwd -P)
50mkdir /tmp/ncurses-${VERSION}
51cd /tmp/ncurses-${VERSION}
52if [ "${ROLLUP}" != "" ]; then
[9676bac]53 echo "Getting Rollup ${ROLLUP} Patch..."
54 wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${ROLLUP}
55 cd ${CURRENTDIR}
56 echo "Applying Rollup ${ROLLUP} Patch..."
57 cp /tmp/ncurses-${VERSION}/${ROLLUP} ${CURRENTDIR}/${ROLLUP}
58 bunzip2 ${ROLLUP}
59 ROLLUP2=$(echo ${ROLLUP} | sed -e 's/.bz2//g')
60 sh ${ROLLUP2}
[06dcdf6]61fi
62
63# Download and Apply Patches
64#
65for file in ${FILES}; do
[9676bac]66 if [ "${ROLLPATCH}" != "" ]; then
67 TEST=$(echo ${file} | grep -c ${ROLLPATCH})
68 else
69 TEST=0
70 fi
71 if [ "${TEST}" = "0" ]; then
72 cd /tmp/ncurses-${VERSION}
73 echo "Getting Patch ${file}..."
74 wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${file}
75 cd ${CURRENTDIR}
76 gunzip -c /tmp/ncurses-${VERSION}/${file} | patch --dry-run -s -f -Np1
77 if [ "$?" = "0" ]; then
78 echo "Apply Patch ${file}..."
79 gunzip -c /tmp/ncurses-${VERSION}/${file} | patch -Np1
80 LASTFILE=$(echo ${file} | cut -f2 -d. | cut -f2 -d-)
81 fi
82 fi
[06dcdf6]83done
84
85# Cleanup Directory
86#
[c0d5090]87# Cleanup Directory
88#
89for dir in $(find * -type d); do
[9676bac]90 cd /usr/src/ncurses-${VERSION}/${dir}
91 for file in $(find . -name '*~'); do
92 rm -f ${file}
93 done
94 for file in $(find . -name '*.orig'); do
95 rm -f ${file}
96 done
[06dcdf6]97done
[e91eb56]98cd /usr/src/ncurses-${VERSION}
[2803d79]99rm -f *~ *.orig
[06dcdf6]100
101# Create Patch
102#
103cd /usr/src
[c7ef534]104echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
105echo "Date: `date +%m-%d-%Y`" >> ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
106echo "Initial Package Version: ${VERSION}" >> ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
107echo "Origin: Upstream" >> ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
108echo "Upstream Status: Applied" >> ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
109echo "Description: This is a branch update for NCurses-${VERSION}, and should be" >> ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
110echo " rechecked periodically. This patch covers up to ${VERSION}-${LASTFILE}." >> ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
111echo "" >> ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
112diff -Naur ncurses-${VERSION}.orig ncurses-${VERSION} >> ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
113echo "Created /usr/src/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch."
Note: See TracBrowser for help on using the repository browser.