source: scripts/patch/ncurses-patch.sh@ 65a1d51

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 65a1d51 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
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#
[d8a9d8b]18cd ~/tmp
[06dcdf6]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#
[d8a9d8b]28cd ~/tmp
[06dcdf6]29if ! [ -e ncurses-${VERSION}.tar.gz ]; then
[9676bac]30 wget ftp://invisible-island.net/ncurses/ncurses-${VERSION}.tar.gz
[06dcdf6]31fi
32
[c7ef534]33# Set Patch Number
34#
[d8a9d8b]35cd ~/tmp
[c7ef534]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
[06dcdf6]41# Cleanup Directory
42#
[d8a9d8b]43cd ~/tmp
[06dcdf6]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#
[d8a9d8b]50cd ~/tmp/ncurses-${VERSION}
[06dcdf6]51CURRENTDIR=$(pwd -P)
[d8a9d8b]52mkdir ~/tmp/ncurses-${VERSION}-patches
53cd ~/tmp/ncurses-${VERSION}
[06dcdf6]54if [ "${ROLLUP}" != "" ]; then
[9676bac]55 echo "Getting Rollup ${ROLLUP} Patch..."
[d8a9d8b]56 cd ~/tmp/ncurses-${VERSION}-patches
[9676bac]57 wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${ROLLUP}
58 cd ${CURRENTDIR}
59 echo "Applying Rollup ${ROLLUP} Patch..."
[d8a9d8b]60 cp ~/tmp/ncurses-${VERSION}-patches/${ROLLUP} ${CURRENTDIR}/${ROLLUP}
[9676bac]61 bunzip2 ${ROLLUP}
62 ROLLUP2=$(echo ${ROLLUP} | sed -e 's/.bz2//g')
63 sh ${ROLLUP2}
[06dcdf6]64fi
65
66# Download and Apply Patches
67#
[d8a9d8b]68install -d ~/tmp/ncurses-${VERSION}-patches
69cd ~/tmp/ncurses-${VERSION}
70CURRENTDIR=$(pwd -P)
[06dcdf6]71for file in ${FILES}; do
[9676bac]72 if [ "${ROLLPATCH}" != "" ]; then
73 TEST=$(echo ${file} | grep -c ${ROLLPATCH})
74 else
75 TEST=0
76 fi
77 if [ "${TEST}" = "0" ]; then
[d8a9d8b]78 cd ~/tmp/ncurses-${VERSION}-patches
[9676bac]79 echo "Getting Patch ${file}..."
80 wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${file}
81 cd ${CURRENTDIR}
[d8a9d8b]82 gunzip -c ~/tmp/ncurses-${VERSION}-patches/${file} | patch --dry-run -s -f -Np1
[9676bac]83 if [ "$?" = "0" ]; then
84 echo "Apply Patch ${file}..."
[d8a9d8b]85 gunzip -c ~/tmp/ncurses-${VERSION}-patches/${file} | patch -Np1
[9676bac]86 LASTFILE=$(echo ${file} | cut -f2 -d. | cut -f2 -d-)
87 fi
88 fi
[06dcdf6]89done
90
91# Cleanup Directory
92#
[d8a9d8b]93cd ~/tmp
94cd ncurses-${VERSION}
[c0d5090]95for dir in $(find * -type d); do
[d8a9d8b]96 cd ~/tmp/ncurses-${VERSION}/${dir}
[9676bac]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
[06dcdf6]103done
[d8a9d8b]104cd ~/tmp/ncurses-${VERSION}
[2803d79]105rm -f *~ *.orig
[06dcdf6]106
107# Create Patch
108#
[d8a9d8b]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.