[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 | #
|
---|
[d8a9d8b] | 18 | cd ~/tmp
|
---|
[06dcdf6] | 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 | #
|
---|
[d8a9d8b] | 28 | cd ~/tmp
|
---|
[06dcdf6] | 29 | if ! [ -e ncurses-${VERSION}.tar.gz ]; then
|
---|
[9676bac] | 30 | wget ftp://invisible-island.net/ncurses/ncurses-${VERSION}.tar.gz
|
---|
[06dcdf6] | 31 | fi
|
---|
| 32 |
|
---|
[c7ef534] | 33 | # Set Patch Number
|
---|
| 34 | #
|
---|
[d8a9d8b] | 35 | cd ~/tmp
|
---|
[29f6db3] | 36 | wget http://svn.cross-lfs.org/svn/repos/patches/ncurses/ --no-remove-listing
|
---|
| 37 | for num in $(seq 1 99); do
|
---|
[4648865] | 38 | PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep branch_update-${num}.patch | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
|
---|
[29f6db3] | 39 | if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
|
---|
| 40 | PATCH_NUM=$(expr ${PATCH_NUM} + 1)
|
---|
| 41 | break
|
---|
| 42 | fi
|
---|
| 43 | if [ "${PATCH_NUM}" != "${num}" ]; then
|
---|
| 44 | PATCH_NUM=$(expr ${num})
|
---|
| 45 | break
|
---|
| 46 | fi
|
---|
| 47 | done
|
---|
[c7ef534] | 48 | rm -f index.html
|
---|
| 49 |
|
---|
[06dcdf6] | 50 | # Cleanup Directory
|
---|
| 51 | #
|
---|
[d8a9d8b] | 52 | cd ~/tmp
|
---|
[06dcdf6] | 53 | rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig
|
---|
| 54 | tar xvf ncurses-${VERSION}.tar.gz
|
---|
| 55 | cp -ar ncurses-${VERSION} ncurses-${VERSION}.orig
|
---|
| 56 |
|
---|
| 57 | # Download and Apply Rollup Patch
|
---|
| 58 | #
|
---|
[d8a9d8b] | 59 | cd ~/tmp/ncurses-${VERSION}
|
---|
[06dcdf6] | 60 | CURRENTDIR=$(pwd -P)
|
---|
[d8a9d8b] | 61 | mkdir ~/tmp/ncurses-${VERSION}-patches
|
---|
| 62 | cd ~/tmp/ncurses-${VERSION}
|
---|
[06dcdf6] | 63 | if [ "${ROLLUP}" != "" ]; then
|
---|
[9676bac] | 64 | echo "Getting Rollup ${ROLLUP} Patch..."
|
---|
[d8a9d8b] | 65 | cd ~/tmp/ncurses-${VERSION}-patches
|
---|
[9676bac] | 66 | wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${ROLLUP}
|
---|
| 67 | cd ${CURRENTDIR}
|
---|
| 68 | echo "Applying Rollup ${ROLLUP} Patch..."
|
---|
[d8a9d8b] | 69 | cp ~/tmp/ncurses-${VERSION}-patches/${ROLLUP} ${CURRENTDIR}/${ROLLUP}
|
---|
[9676bac] | 70 | bunzip2 ${ROLLUP}
|
---|
| 71 | ROLLUP2=$(echo ${ROLLUP} | sed -e 's/.bz2//g')
|
---|
| 72 | sh ${ROLLUP2}
|
---|
[06dcdf6] | 73 | fi
|
---|
| 74 |
|
---|
| 75 | # Download and Apply Patches
|
---|
| 76 | #
|
---|
[d8a9d8b] | 77 | install -d ~/tmp/ncurses-${VERSION}-patches
|
---|
| 78 | cd ~/tmp/ncurses-${VERSION}
|
---|
| 79 | CURRENTDIR=$(pwd -P)
|
---|
[06dcdf6] | 80 | for file in ${FILES}; do
|
---|
[9676bac] | 81 | if [ "${ROLLPATCH}" != "" ]; then
|
---|
| 82 | TEST=$(echo ${file} | grep -c ${ROLLPATCH})
|
---|
| 83 | else
|
---|
| 84 | TEST=0
|
---|
| 85 | fi
|
---|
| 86 | if [ "${TEST}" = "0" ]; then
|
---|
[d8a9d8b] | 87 | cd ~/tmp/ncurses-${VERSION}-patches
|
---|
[9676bac] | 88 | echo "Getting Patch ${file}..."
|
---|
| 89 | wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${file}
|
---|
| 90 | cd ${CURRENTDIR}
|
---|
[d8a9d8b] | 91 | gunzip -c ~/tmp/ncurses-${VERSION}-patches/${file} | patch --dry-run -s -f -Np1
|
---|
[9676bac] | 92 | if [ "$?" = "0" ]; then
|
---|
| 93 | echo "Apply Patch ${file}..."
|
---|
[d8a9d8b] | 94 | gunzip -c ~/tmp/ncurses-${VERSION}-patches/${file} | patch -Np1
|
---|
[9676bac] | 95 | LASTFILE=$(echo ${file} | cut -f2 -d. | cut -f2 -d-)
|
---|
| 96 | fi
|
---|
| 97 | fi
|
---|
[06dcdf6] | 98 | done
|
---|
| 99 |
|
---|
| 100 | # Cleanup Directory
|
---|
| 101 | #
|
---|
[d8a9d8b] | 102 | cd ~/tmp
|
---|
| 103 | cd ncurses-${VERSION}
|
---|
[c0d5090] | 104 | for dir in $(find * -type d); do
|
---|
[d8a9d8b] | 105 | cd ~/tmp/ncurses-${VERSION}/${dir}
|
---|
[9676bac] | 106 | for file in $(find . -name '*~'); do
|
---|
| 107 | rm -f ${file}
|
---|
| 108 | done
|
---|
| 109 | for file in $(find . -name '*.orig'); do
|
---|
| 110 | rm -f ${file}
|
---|
| 111 | done
|
---|
[06dcdf6] | 112 | done
|
---|
[d8a9d8b] | 113 | cd ~/tmp/ncurses-${VERSION}
|
---|
[2803d79] | 114 | rm -f *~ *.orig
|
---|
[06dcdf6] | 115 |
|
---|
| 116 | # Create Patch
|
---|
| 117 | #
|
---|
[d8a9d8b] | 118 | cd ~/tmp
|
---|
| 119 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 120 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 121 | echo "Initial Package Version: ${VERSION}" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 122 | echo "Origin: Upstream" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 123 | echo "Upstream Status: Applied" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 124 | echo "Description: This is a branch update for NCurses-${VERSION}, and should be" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 125 | echo " rechecked periodically. This patch covers up to ${VERSION}-${LASTFILE}." >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 126 | echo "" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 127 | diff -Naur ncurses-${VERSION}.orig ncurses-${VERSION} >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 128 | echo "Created ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch."
|
---|
| 129 |
|
---|
| 130 | # Cleanup Directory
|
---|
| 131 | #
|
---|
| 132 | cd ~/tmp
|
---|
| 133 | rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig
|
---|