1 | #!/bin/sh
|
---|
2 | # Jonathan Norman
|
---|
3 |
|
---|
4 | # Ncurses branch update patch generator
|
---|
5 |
|
---|
6 | VERSION=$1
|
---|
7 |
|
---|
8 | # Check Input
|
---|
9 | #
|
---|
10 | if [ "${VERSION}" = "" ]; then
|
---|
11 | echo "$0 [ncurses_version]"
|
---|
12 | echo "This will Create a Patch for ncurses ncurses_Version"
|
---|
13 | exit 255
|
---|
14 | fi
|
---|
15 |
|
---|
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/
|
---|
21 |
|
---|
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)
|
---|
26 |
|
---|
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
|
---|
35 |
|
---|
36 |
|
---|
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
|
---|
42 |
|
---|
43 | echo -n "Generating Patch..."
|
---|
44 | cd ncurses-${VERSION}
|
---|
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
|
---|
49 | done
|
---|
50 |
|
---|
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"
|
---|