source: scripts/patch/ncurses-patch.sh@ 06dcdf6

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 06dcdf6 was 06dcdf6, checked in by Jim Gifford <clfs@…>, 16 years ago

Added Patch Creation Scripts

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