[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
|
---|
[639e34d] | 36 | wget http://patches.cross-lfs.org/dev/ --no-remove-listing
|
---|
[c7ef534] | 37 | PATCH_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)
|
---|
| 38 | PATCH_NUM=$(expr ${PATCH_NUM} + 1)
|
---|
| 39 | rm -f index.html
|
---|
| 40 |
|
---|
[06dcdf6] | 41 | # Cleanup Directory
|
---|
| 42 | #
|
---|
[d8a9d8b] | 43 | cd ~/tmp
|
---|
[06dcdf6] | 44 | rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig
|
---|
| 45 | tar xvf ncurses-${VERSION}.tar.gz
|
---|
| 46 | cp -ar ncurses-${VERSION} ncurses-${VERSION}.orig
|
---|
| 47 |
|
---|
| 48 | # Download and Apply Rollup Patch
|
---|
| 49 | #
|
---|
[d8a9d8b] | 50 | cd ~/tmp/ncurses-${VERSION}
|
---|
[06dcdf6] | 51 | CURRENTDIR=$(pwd -P)
|
---|
[d8a9d8b] | 52 | mkdir ~/tmp/ncurses-${VERSION}-patches
|
---|
| 53 | cd ~/tmp/ncurses-${VERSION}
|
---|
[06dcdf6] | 54 | if [ "${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] | 64 | fi
|
---|
| 65 |
|
---|
| 66 | # Download and Apply Patches
|
---|
| 67 | #
|
---|
[d8a9d8b] | 68 | install -d ~/tmp/ncurses-${VERSION}-patches
|
---|
| 69 | cd ~/tmp/ncurses-${VERSION}
|
---|
| 70 | CURRENTDIR=$(pwd -P)
|
---|
[06dcdf6] | 71 | for 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] | 89 | done
|
---|
| 90 |
|
---|
| 91 | # Cleanup Directory
|
---|
| 92 | #
|
---|
[d8a9d8b] | 93 | cd ~/tmp
|
---|
| 94 | cd ncurses-${VERSION}
|
---|
[c0d5090] | 95 | for 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] | 103 | done
|
---|
[d8a9d8b] | 104 | cd ~/tmp/ncurses-${VERSION}
|
---|
[2803d79] | 105 | rm -f *~ *.orig
|
---|
[06dcdf6] | 106 |
|
---|
| 107 | # Create Patch
|
---|
| 108 | #
|
---|
[d8a9d8b] | 109 | cd ~/tmp
|
---|
| 110 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 111 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 112 | echo "Initial Package Version: ${VERSION}" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 113 | echo "Origin: Upstream" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 114 | echo "Upstream Status: Applied" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 115 | echo "Description: This is a branch update for NCurses-${VERSION}, and should be" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 116 | echo " rechecked periodically. This patch covers up to ${VERSION}-${LASTFILE}." >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 117 | echo "" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 118 | diff -Naur ncurses-${VERSION}.orig ncurses-${VERSION} >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 119 | echo "Created ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch."
|
---|
| 120 |
|
---|
| 121 | # Cleanup Directory
|
---|
| 122 | #
|
---|
| 123 | cd ~/tmp
|
---|
| 124 | rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig
|
---|