source: scripts/patch/ncurses-patch.sh @ 61a83e8

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 61a83e8 was 9676bac, checked in by Jim Gifford <clfs@…>, 15 years ago

Added Perl Patch and cleaned up

  • Property mode set to 100755
File size: 3.1 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 /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
29  wget ftp://invisible-island.net/ncurses/ncurses-${VERSION}.tar.gz
30fi
31
32# Cleanup Directory
33#
34rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig
35tar xvf ncurses-${VERSION}.tar.gz
36cp -ar ncurses-${VERSION} ncurses-${VERSION}.orig
37cd ncurses-${VERSION}
38
39# Download and Apply Rollup Patch
40#
41CURRENTDIR=$(pwd -P)
42mkdir /tmp/ncurses-${VERSION}
43cd /tmp/ncurses-${VERSION}
44if [ "${ROLLUP}" != "" ]; then
45  echo "Getting Rollup ${ROLLUP} Patch..."
46  wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${ROLLUP}
47  cd ${CURRENTDIR}
48  echo "Applying Rollup ${ROLLUP} Patch..."
49  cp /tmp/ncurses-${VERSION}/${ROLLUP} ${CURRENTDIR}/${ROLLUP}
50  bunzip2 ${ROLLUP}
51  ROLLUP2=$(echo ${ROLLUP} | sed -e 's/.bz2//g')
52  sh ${ROLLUP2}
53fi
54
55# Download and Apply Patches
56#
57for file in ${FILES}; do
58  if [ "${ROLLPATCH}" != "" ]; then
59    TEST=$(echo ${file} | grep -c ${ROLLPATCH})
60  else
61    TEST=0
62  fi
63  if [ "${TEST}" = "0" ]; then
64    cd /tmp/ncurses-${VERSION}
65    echo "Getting Patch ${file}..."
66    wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${file}
67    cd ${CURRENTDIR}
68    gunzip -c /tmp/ncurses-${VERSION}/${file} | patch --dry-run -s -f -Np1
69    if [ "$?" = "0" ]; then
70      echo "Apply Patch ${file}..."
71      gunzip -c /tmp/ncurses-${VERSION}/${file} | patch -Np1
72      LASTFILE=$(echo ${file} | cut -f2 -d. | cut -f2 -d-)
73    fi
74  fi
75done
76
77# Cleanup Directory
78#
79# Cleanup Directory
80#
81for dir in $(find * -type d); do
82  cd /usr/src/ncurses-${VERSION}/${dir}
83  for file in $(find . -name '*~'); do
84    rm -f ${file}
85  done
86  for file in $(find . -name '*.orig'); do
87    rm -f ${file}
88  done
89done
90cd /usr/src/ncurses-${VERSION}
91rm -f *~ *.orig
92
93# Create Patch
94#
95cd /usr/src
96echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ncurses-${VERSION}-branch_update-x.patch
97echo "Date: `date +%m-%d-%Y`" >> ncurses-${VERSION}-branch_update-x.patch
98echo "Initial Package Version: ${VERSION}" >> ncurses-${VERSION}-branch_update-x.patch
99echo "Origin: Upstream" >> ncurses-${VERSION}-branch_update-x.patch
100echo "Upstream Status: Applied" >> ncurses-${VERSION}-branch_update-x.patch
101echo "Description: This is a branch update for NCurses-${VERSION}, and should be" >> ncurses-${VERSION}-branch_update-x.patch
102echo "             rechecked periodically. This patch covers up to ${VERSION}-${LASTFILE}." >> ncurses-${VERSION}-branch_update-x.patch
103echo "" >> ncurses-${VERSION}-branch_update-x.patch
104diff -Naur ncurses-${VERSION}.orig ncurses-${VERSION} >> ncurses-${VERSION}-branch_update-x.patch
105echo "Created /usr/src/ncurses-${VERSION}-branch_update-x.patch."
Note: See TracBrowser for help on using the repository browser.