[06dcdf6] | 1 | #!/bin/bash
|
---|
| 2 | # Create a Ncuruses Patch
|
---|
| 3 |
|
---|
| 4 | # Get Version #
|
---|
| 5 | #
|
---|
| 6 | VERSION=$1
|
---|
| 7 |
|
---|
| 8 | # Check Input
|
---|
| 9 | #
|
---|
| 10 | if [ "${VERSION}" = "" ]; then
|
---|
[9676bac] | 11 | echo "$0 - Ncurses_Version"
|
---|
| 12 | echo "This will Create a Patch for Ncurses Ncurses_Version"
|
---|
| 13 | exit 255
|
---|
[06dcdf6] | 14 | fi
|
---|
| 15 |
|
---|
| 16 | # Get Patch Names
|
---|
| 17 | #
|
---|
| 18 | cd /usr/src
|
---|
| 19 | wget ftp://invisible-island.net/ncurses/${VERSION}/ --no-remove-listing
|
---|
| 20 | ROLLUP=$(cat index.html | grep bz2 | cut -f2 -d'>' | cut -f1 -d'<' | tail -n 1)
|
---|
| 21 | ROLLPATCH=$(echo ${ROLLUP} | cut -f3 -d-)
|
---|
| 22 | FILES=$(cat index.html | grep ${VERSION}-2 | grep patch.gz | cut -f2 -d'>' | cut -f1 -d'<')
|
---|
| 23 | rm -f .listing
|
---|
| 24 | rm -f index.html
|
---|
| 25 |
|
---|
| 26 | # Download Ncurses Source
|
---|
| 27 | #
|
---|
| 28 | if ! [ -e ncurses-${VERSION}.tar.gz ]; then
|
---|
[9676bac] | 29 | wget ftp://invisible-island.net/ncurses/ncurses-${VERSION}.tar.gz
|
---|
[06dcdf6] | 30 | fi
|
---|
| 31 |
|
---|
| 32 | # Cleanup Directory
|
---|
| 33 | #
|
---|
| 34 | rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig
|
---|
| 35 | tar xvf ncurses-${VERSION}.tar.gz
|
---|
| 36 | cp -ar ncurses-${VERSION} ncurses-${VERSION}.orig
|
---|
| 37 | cd ncurses-${VERSION}
|
---|
| 38 |
|
---|
| 39 | # Download and Apply Rollup Patch
|
---|
| 40 | #
|
---|
| 41 | CURRENTDIR=$(pwd -P)
|
---|
| 42 | mkdir /tmp/ncurses-${VERSION}
|
---|
| 43 | cd /tmp/ncurses-${VERSION}
|
---|
| 44 | if [ "${ROLLUP}" != "" ]; then
|
---|
[9676bac] | 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}
|
---|
[06dcdf6] | 53 | fi
|
---|
| 54 |
|
---|
| 55 | # Download and Apply Patches
|
---|
| 56 | #
|
---|
| 57 | for file in ${FILES}; do
|
---|
[9676bac] | 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
|
---|
[06dcdf6] | 75 | done
|
---|
| 76 |
|
---|
| 77 | # Cleanup Directory
|
---|
| 78 | #
|
---|
[c0d5090] | 79 | # Cleanup Directory
|
---|
| 80 | #
|
---|
| 81 | for dir in $(find * -type d); do
|
---|
[9676bac] | 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
|
---|
[06dcdf6] | 89 | done
|
---|
[e91eb56] | 90 | cd /usr/src/ncurses-${VERSION}
|
---|
[2803d79] | 91 | rm -f *~ *.orig
|
---|
[06dcdf6] | 92 |
|
---|
| 93 | # Create Patch
|
---|
| 94 | #
|
---|
| 95 | cd /usr/src
|
---|
[c94176e] | 96 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ncurses-${VERSION}-branch_update-x.patch
|
---|
[06dcdf6] | 97 | echo "Date: `date +%m-%d-%Y`" >> ncurses-${VERSION}-branch_update-x.patch
|
---|
| 98 | echo "Initial Package Version: ${VERSION}" >> ncurses-${VERSION}-branch_update-x.patch
|
---|
| 99 | echo "Origin: Upstream" >> ncurses-${VERSION}-branch_update-x.patch
|
---|
| 100 | echo "Upstream Status: Applied" >> ncurses-${VERSION}-branch_update-x.patch
|
---|
| 101 | echo "Description: This is a branch update for NCurses-${VERSION}, and should be" >> ncurses-${VERSION}-branch_update-x.patch
|
---|
| 102 | echo " rechecked periodically. This patch covers up to ${VERSION}-${LASTFILE}." >> ncurses-${VERSION}-branch_update-x.patch
|
---|
| 103 | echo "" >> ncurses-${VERSION}-branch_update-x.patch
|
---|
| 104 | diff -Naur ncurses-${VERSION}.orig ncurses-${VERSION} >> ncurses-${VERSION}-branch_update-x.patch
|
---|
| 105 | echo "Created /usr/src/ncurses-${VERSION}-branch_update-x.patch."
|
---|