[0e9e889] | 1 | #!/bin/bash
|
---|
| 2 | # Create a Busybox Patch
|
---|
| 3 |
|
---|
| 4 | # Get Version #
|
---|
| 5 | #
|
---|
| 6 | VERSION=$1
|
---|
| 7 |
|
---|
| 8 | # Check Input
|
---|
| 9 | #
|
---|
| 10 | if [ "${VERSION}" = "" ]; then
|
---|
| 11 | echo "$0 - Busybox_Version"
|
---|
| 12 | echo "This will Create a Patch for Busybox Busybox_Version"
|
---|
| 13 | exit 255
|
---|
| 14 | fi
|
---|
| 15 |
|
---|
| 16 | # Get Patch Names
|
---|
| 17 | #
|
---|
| 18 | cd /usr/src
|
---|
| 19 | wget http://busybox.net/downloads/fixes-${VERSION}/ --no-remove-listing
|
---|
| 20 | FILES=$(cat index.html | grep patch | grep patch | cut -f3 -d'<' | cut -f2 -d'>')
|
---|
| 21 | rm -f .listing
|
---|
| 22 | rm -f index.html
|
---|
| 23 |
|
---|
| 24 | # Download Busybox Source
|
---|
| 25 | #
|
---|
| 26 | if ! [ -e busybox-${VERSION}.tar.bz2 ]; then
|
---|
| 27 | wget http://busybox.net/downloads/busybox-${VERSION}.tar.bz2
|
---|
| 28 | fi
|
---|
| 29 |
|
---|
| 30 | # Cleanup Directory
|
---|
| 31 | #
|
---|
| 32 | rm -rf busybox-${VERSION} busybox-${VERSION}.orig
|
---|
| 33 | tar xvf busybox-${VERSION}.tar.bz2
|
---|
| 34 | cp -ar busybox-${VERSION} busybox-${VERSION}.orig
|
---|
| 35 | cd busybox-${VERSION}
|
---|
| 36 | CURRENTDIR=$(pwd -P)
|
---|
| 37 |
|
---|
| 38 | # Download and Apply Patches
|
---|
| 39 | #
|
---|
| 40 | mkdir /tmp/busybox-${VERSION}
|
---|
| 41 | for file in ${FILES}; do
|
---|
| 42 | cd /tmp/busybox-${VERSION}
|
---|
| 43 | echo "Getting Patch ${file}..."
|
---|
| 44 | wget --quiet http://busybox.net/downloads/fixes-${VERSION}/${file}
|
---|
| 45 | cd ${CURRENTDIR}
|
---|
| 46 | patch --dry-run -s -f -Np1 -i /tmp/busybox-${VERSION}/${file}
|
---|
| 47 | if [ "$?" = "0" ]; then
|
---|
| 48 | echo "Apply Patch ${file}..."
|
---|
| 49 | patch -Np1 -i /tmp/busybox-${VERSION}/${file}
|
---|
| 50 | fi
|
---|
| 51 | done
|
---|
| 52 |
|
---|
| 53 | # Cleanup Directory
|
---|
| 54 | #
|
---|
| 55 | for dir in $(find * -type d); do
|
---|
| 56 | cd /usr/src/busybox-${VERSION}/${dir}
|
---|
| 57 | for file in $(find . -name '*~'); do
|
---|
| 58 | rm -f ${file}
|
---|
| 59 | done
|
---|
| 60 | for file in $(find . -name '*.orig'); do
|
---|
| 61 | rm -f ${file}
|
---|
| 62 | done
|
---|
| 63 | done
|
---|
| 64 | cd /usr/src/busybox-${VERSION}
|
---|
| 65 | rm -f *~ *.orig
|
---|
| 66 |
|
---|
| 67 | # Create Patch
|
---|
| 68 | #
|
---|
| 69 | cd /usr/src
|
---|
| 70 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > busybox-${VERSION}-branch_update-x.patch
|
---|
| 71 | echo "Date: `date +%m-%d-%Y`" >> busybox-${VERSION}-branch_update-x.patch
|
---|
| 72 | echo "Initial Package Version: ${VERSION}" >> busybox-${VERSION}-branch_update-x.patch
|
---|
| 73 | echo "Origin: Upstream" >> busybox-${VERSION}-branch_update-x.patch
|
---|
| 74 | echo "Upstream Status: Applied" >> busybox-${VERSION}-branch_update-x.patch
|
---|
| 75 | echo "Description: This is a branch update for busybox-${VERSION}, and should be" >> busybox-${VERSION}-branch_update-x.patch
|
---|
| 76 | echo " rechecked periodically." >> busybox-${VERSION}-branch_update-x.patch
|
---|
| 77 | echo "" >> busybox-${VERSION}-branch_update-x.patch
|
---|
| 78 | diff -Naur busybox-${VERSION}.orig busybox-${VERSION} >> busybox-${VERSION}-branch_update-x.patch
|
---|
| 79 | echo "Created /usr/src/busybox-${VERSION}-branch_update-x.patch."
|
---|