[20a0aa0] | 1 | #!/bin/sh
|
---|
| 2 | # Jonathan Norman
|
---|
| 3 |
|
---|
| 4 | # Ncurses branch update patch generator
|
---|
[06dcdf6] | 5 |
|
---|
| 6 | VERSION=$1
|
---|
| 7 |
|
---|
| 8 | # Check Input
|
---|
| 9 | #
|
---|
| 10 | if [ "${VERSION}" = "" ]; then
|
---|
[20a0aa0] | 11 | echo "$0 [ncurses_version]"
|
---|
| 12 | echo "This will Create a Patch for ncurses ncurses_Version"
|
---|
[9676bac] | 13 | exit 255
|
---|
[06dcdf6] | 14 | fi
|
---|
| 15 |
|
---|
[20a0aa0] | 16 | TMP=~/tmp/ncurses-${VERSION}
|
---|
| 17 | PATCHDIR=${TMP}/patches
|
---|
| 18 | PATCHURL=ftp://invisible-island.net/ncurses/
|
---|
| 19 | SERIES=$(echo ${VERSION} | sed -e 's/\.//g')
|
---|
| 20 | CLFS_PATCHS=http://patches.cross-lfs.org/dev/
|
---|
[06dcdf6] | 21 |
|
---|
[20a0aa0] | 22 | # Figure out patch number
|
---|
| 23 | UPDATE_NUM=0
|
---|
| 24 | UPDATE_NUM=$(curl -ls http://patches.cross-lfs.org/dev/ | grep ncurses-${VERSION}-branch_update | cut -d . -f 3 | cut -d - -f 3-)
|
---|
| 25 | UPDATE_NUM=$(expr ${UPDATE_NUM} + 1)
|
---|
[c7ef534] | 26 |
|
---|
[20a0aa0] | 27 | # Download patches
|
---|
| 28 | echo "Downloading patches for Ncurses ${VERSION}"
|
---|
| 29 | FILES=$(curl -sl ftp://invisible-island.net/ncurses/${VERSION}/ | grep patch | grep -v bz2 | grep -v asc)
|
---|
| 30 | mkdir -p $PATCHDIR
|
---|
| 31 | cd $PATCHDIR
|
---|
| 32 | for FILE in $FILES; do
|
---|
| 33 | curl -O -# $PATCHURL/$VERSION/$FILE
|
---|
| 34 | done
|
---|
[06dcdf6] | 35 |
|
---|
| 36 |
|
---|
[20a0aa0] | 37 | echo "Downloading source for Ncurses $VERSION"
|
---|
| 38 | cd $TMP
|
---|
| 39 | curl -sO ftp://invisible-island.net/ncurses/ncurses-${VERSION}.tar.gz
|
---|
| 40 | tar -xvf ncurses-${VERSION}.tar.gz
|
---|
| 41 | cp -R ncurses-${VERSION} ncurses-${VERSION}.orig
|
---|
[06dcdf6] | 42 |
|
---|
[20a0aa0] | 43 | echo -n "Generating Patch..."
|
---|
[d8a9d8b] | 44 | cd ncurses-${VERSION}
|
---|
[20a0aa0] | 45 |
|
---|
| 46 | gunzip -c $PATCHDIR/*.sh.gz | sh
|
---|
| 47 | for PATCH in $(ls $PATCHDIR | grep patch.gz); do
|
---|
| 48 | gunzip -c $PATCHDIR/$PATCH | patch -Np1
|
---|
[06dcdf6] | 49 | done
|
---|
| 50 |
|
---|
[20a0aa0] | 51 | cd $TMP
|
---|
| 52 |
|
---|
| 53 | DATE=$(ls $PATCHDIR | tail -n1 | cut -d- -f3 | cut -d. -f1);
|
---|
| 54 |
|
---|
| 55 | # Create patch
|
---|
| 56 | echo "Submitted By: Jonathan Norman (jonathan at bluesquarelinux dot co dot uk)" > ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 57 | echo "Date: `date +%Y-%m-%d`" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 58 | echo "Initial Package Version: ${VERSION}" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 59 | echo "Origin: Upstream" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 60 | echo "Upstream Status: Applied" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 61 | echo "Description: Contains all upstream patches up to ${VERSION}-${DATE}" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 62 | echo "" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 63 |
|
---|
| 64 | LC_ALL=C TZ=UTC0 diff -Naur ncurses-${VERSION}.orig ncurses-${VERSION} >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 65 |
|
---|
| 66 | echo "Done"
|
---|
| 67 | echo "Cleaning up"
|
---|
| 68 | rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig #ncurses-${VERSION}.tar.bz2
|
---|
| 69 |
|
---|
| 70 | echo "Created: $PWD/ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch"
|
---|