[06dcdf6] | 1 | #!/bin/bash
|
---|
| 2 | # Create a VIM Patch
|
---|
| 3 |
|
---|
| 4 | # Get Version #
|
---|
| 5 | #
|
---|
| 6 | VERSION=$1
|
---|
| 7 |
|
---|
| 8 | # Check Input
|
---|
| 9 | #
|
---|
| 10 | if [ "${VERSION}" = "" ]; then
|
---|
| 11 | echo "$0 - Vim_Version"
|
---|
| 12 | echo "This will Create a Patch for Vim Vim_Version"
|
---|
| 13 | fi
|
---|
| 14 |
|
---|
| 15 | # Get the # of Patches
|
---|
| 16 | #
|
---|
| 17 | cd /usr/src
|
---|
| 18 | wget ftp://ftp.vim.org/pub/vim/patches/${VERSION}/ --no-remove-listing
|
---|
| 19 | FILES=$(cat index.html | grep "${VERSION}" | cut -f6 -d. | cut -f1 -d'"' | sed '/^$/d' | tail -n 1)
|
---|
| 20 | rm -f .listing
|
---|
| 21 | rm -f index.html
|
---|
| 22 | SERIES=$(echo ${VERSION} | sed -e 's/\.//g')
|
---|
| 23 | SKIPPATCH=""
|
---|
| 24 | SKIPPED=""
|
---|
| 25 |
|
---|
| 26 | # Download VIM Source
|
---|
| 27 | #
|
---|
| 28 | if ! [ -e vim-${VERSION}.tar.bz2 ]; then
|
---|
| 29 | wget ftp://ftp.vim.org/pub/vim/unix/vim-${VERSION}.tar.bz2
|
---|
| 30 | fi
|
---|
| 31 |
|
---|
| 32 | # Cleanup Directory
|
---|
| 33 | #
|
---|
| 34 | rm -rf vim${SERIES} vim${SERIES}.orig
|
---|
| 35 | tar xvf vim-${VERSION}.tar.bz2
|
---|
| 36 | cp -ar vim${SERIES} vim${SERIES}.orig
|
---|
| 37 | cd vim${SERIES}
|
---|
| 38 | CURRENTDIR=$(pwd -P)
|
---|
| 39 |
|
---|
| 40 | # Download and Apply Patches
|
---|
| 41 | #
|
---|
| 42 | PATCHURL=ftp://ftp.vim.org/pub/vim/patches/${VERSION}
|
---|
| 43 | mkdir /tmp/vim-${VERSION}
|
---|
| 44 | COUNT=1
|
---|
| 45 | while [ ${COUNT} -le ${FILES} ]; do
|
---|
| 46 | cd /tmp/vim-${VERSION}
|
---|
| 47 | DLCOUNT="${COUNT}"
|
---|
| 48 | SKIPME=no
|
---|
| 49 | if [ "${COUNT}" -lt "100" ]; then
|
---|
| 50 | DLCOUNT="0${COUNT}"
|
---|
| 51 | fi
|
---|
| 52 | if [ "${COUNT}" -lt "10" ]; then
|
---|
| 53 | DLCOUNT="00${COUNT}"
|
---|
| 54 | fi
|
---|
| 55 | for skip in ${SKIPPATCH} ; do
|
---|
| 56 | if [ "${DLCOUNT}" = "${skip}" ]; then
|
---|
| 57 | echo "Patch ${VERSION}.${DLCOUNT} skipped"
|
---|
| 58 | SKIPPED="${SKIPPED} ${DLCOUNT}"
|
---|
| 59 | SKIPME=yes
|
---|
| 60 | fi
|
---|
| 61 | done
|
---|
| 62 | if [ "${SKIPME}" != "yes" ]; then
|
---|
| 63 | if ! [ -e ${VERSION}.${DLCOUNT} ]; then
|
---|
| 64 | wget --quiet $PATCHURL/${VERSION}.${DLCOUNT}
|
---|
| 65 | fi
|
---|
| 66 | cd $CURRENTDIR
|
---|
| 67 | patch --dry-run -s -f -Np0 -i /tmp/vim-${VERSION}/${VERSION}.${DLCOUNT}
|
---|
| 68 | if [ "$?" = "0" ]; then
|
---|
| 69 | echo "Patch ${VERSION}.${DLCOUNT} applied"
|
---|
| 70 | patch -s -Np0 -i /tmp/vim-${VERSION}/${VERSION}.${DLCOUNT}
|
---|
| 71 | else
|
---|
| 72 | echo "Patch ${VERSION}.${DLCOUNT} not applied"
|
---|
| 73 | rm -f /tmp/vim-${VERSION}/${VERSION}.${DLCOUNT}
|
---|
| 74 | SKIPPED="${SKIPPED} ${DLCOUNT}"
|
---|
| 75 | fi
|
---|
| 76 | fi
|
---|
| 77 | COUNT=`expr ${COUNT} + 1`
|
---|
| 78 | done
|
---|
| 79 |
|
---|
| 80 | # Cleanup Directory
|
---|
| 81 | #
|
---|
[c0d5090] | 82 | # Cleanup Directory
|
---|
| 83 | #
|
---|
| 84 | for dir in $(find * -type d); do
|
---|
| 85 | cd /usr/src/vim${SERIES}/${dir}
|
---|
| 86 | for file in $(find * -name *~); do
|
---|
| 87 | rm -f ${file}
|
---|
| 88 | done
|
---|
| 89 | for file in $(find * -name *.orig); do
|
---|
| 90 | rm -f ${file}
|
---|
| 91 | done
|
---|
[06dcdf6] | 92 | done
|
---|
[e91eb56] | 93 | cd /usr/src/vim${SERIES}
|
---|
[d57287f4] | 94 | rm -f *.orig *~
|
---|
[06dcdf6] | 95 |
|
---|
| 96 | # Create Patch
|
---|
| 97 | #
|
---|
| 98 | cd /usr/src
|
---|
[c94176e] | 99 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > vim-${VERSION}-branch_update-x.patch
|
---|
[06dcdf6] | 100 | echo "Date: `date +%m-%d-%Y`" >> vim-${VERSION}-branch_update-x.patch
|
---|
| 101 | echo "Initial Package Version: ${VERSION}" >> vim-${VERSION}-branch_update-x.patch
|
---|
| 102 | echo "Origin: Upstream" >> vim-${VERSION}-branch_update-x.patch
|
---|
| 103 | echo "Upstream Status: Applied" >> vim-${VERSION}-branch_update-x.patch
|
---|
| 104 | echo "Description: Contains all upstream patches up to ${VERSION}.${FILES}" >> vim-${VERSION}-branch_update-x.patch
|
---|
| 105 | if [ -n "${SKIPPED}" ]; then
|
---|
| 106 | echo " The following patches were skipped" >> vim-${VERSION}-branch_update-x.patch
|
---|
| 107 | echo " ${SKIPPED}" >> vim-${VERSION}-branch_update-x.patch
|
---|
| 108 | fi
|
---|
| 109 | echo "" >> vim-${VERSION}-branch_update-x.patch
|
---|
| 110 | diff -Naur vim${SERIES}.orig vim${SERIES} >> vim-${VERSION}-branch_update-x.patch
|
---|
| 111 | echo "Created /usr/src/vim-${VERSION}-branch_update-x.patch."
|
---|
| 112 |
|
---|