source: scripts/patch/ncurses-patch.sh@ 2716c08

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

Updates to Patch Scripts

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