source: clfs-embedded/scripts/patch/busybox-patch.sh@ 8c63653

Last change on this file since 8c63653 was 0e9e889, checked in by Jim Gifford <clfs@…>, 16 years ago

Starting Busybox Updates

  • Property mode set to 100755
File size: 2.3 KB
RevLine 
[0e9e889]1#!/bin/bash
2# Create a Busybox Patch
3
4# Get Version #
5#
6VERSION=$1
7
8# Check Input
9#
10if [ "${VERSION}" = "" ]; then
11 echo "$0 - Busybox_Version"
12 echo "This will Create a Patch for Busybox Busybox_Version"
13 exit 255
14fi
15
16# Get Patch Names
17#
18cd /usr/src
19wget http://busybox.net/downloads/fixes-${VERSION}/ --no-remove-listing
20FILES=$(cat index.html | grep patch | grep patch | cut -f3 -d'<' | cut -f2 -d'>')
21rm -f .listing
22rm -f index.html
23
24# Download Busybox Source
25#
26if ! [ -e busybox-${VERSION}.tar.bz2 ]; then
27 wget http://busybox.net/downloads/busybox-${VERSION}.tar.bz2
28fi
29
30# Cleanup Directory
31#
32rm -rf busybox-${VERSION} busybox-${VERSION}.orig
33tar xvf busybox-${VERSION}.tar.bz2
34cp -ar busybox-${VERSION} busybox-${VERSION}.orig
35cd busybox-${VERSION}
36CURRENTDIR=$(pwd -P)
37
38# Download and Apply Patches
39#
40mkdir /tmp/busybox-${VERSION}
41for 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
51done
52
53# Cleanup Directory
54#
55for 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
63done
64cd /usr/src/busybox-${VERSION}
65rm -f *~ *.orig
66
67# Create Patch
68#
69cd /usr/src
70echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > busybox-${VERSION}-branch_update-x.patch
71echo "Date: `date +%m-%d-%Y`" >> busybox-${VERSION}-branch_update-x.patch
72echo "Initial Package Version: ${VERSION}" >> busybox-${VERSION}-branch_update-x.patch
73echo "Origin: Upstream" >> busybox-${VERSION}-branch_update-x.patch
74echo "Upstream Status: Applied" >> busybox-${VERSION}-branch_update-x.patch
75echo "Description: This is a branch update for busybox-${VERSION}, and should be" >> busybox-${VERSION}-branch_update-x.patch
76echo " rechecked periodically." >> busybox-${VERSION}-branch_update-x.patch
77echo "" >> busybox-${VERSION}-branch_update-x.patch
78diff -Naur busybox-${VERSION}.orig busybox-${VERSION} >> busybox-${VERSION}-branch_update-x.patch
79echo "Created /usr/src/busybox-${VERSION}-branch_update-x.patch."
Note: See TracBrowser for help on using the repository browser.