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

Last change on this file since b0386e9 was ea546c8, checked in by Jim Gifford <clfs@…>, 16 years ago

Updates to Patch Creaters

  • Property mode set to 100755
File size: 2.7 KB
Line 
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# Set Patch Number
31#
32cd /usr/src
33wget http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/ --no-remove-listing
34PATCH_NUM=$(cat index.html | grep busybox | grep "${VERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
35PATCH_NUM=$(expr ${PATCH_NUM} + 1)
36rm -f index.html
37
38# Cleanup Directory
39#
40rm -rf busybox-${VERSION} busybox-${VERSION}.orig
41tar xvf busybox-${VERSION}.tar.bz2
42cp -ar busybox-${VERSION} busybox-${VERSION}.orig
43cd busybox-${VERSION}
44CURRENTDIR=$(pwd -P)
45
46# Download and Apply Patches
47#
48mkdir /tmp/busybox-${VERSION}
49for file in ${FILES}; do
50 cd /tmp/busybox-${VERSION}
51 echo "Getting Patch ${file}..."
52 wget --quiet http://busybox.net/downloads/fixes-${VERSION}/${file}
53 cd ${CURRENTDIR}
54 patch --dry-run -s -f -Np1 -i /tmp/busybox-${VERSION}/${file}
55 if [ "$?" = "0" ]; then
56 echo "Apply Patch ${file}..."
57 patch -Np1 -i /tmp/busybox-${VERSION}/${file}
58 fi
59done
60
61# Cleanup Directory
62#
63for dir in $(find * -type d); do
64 cd /usr/src/busybox-${VERSION}/${dir}
65 for file in $(find . -name '*~'); do
66 rm -f ${file}
67 done
68 for file in $(find . -name '*.orig'); do
69 rm -f ${file}
70 done
71done
72cd /usr/src/busybox-${VERSION}
73rm -f *~ *.orig
74
75# Create Patch
76#
77cd /usr/src
78echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > busybox-${VERSION}-branch_update-${PATCH_NUM}.patch
79echo "Date: `date +%m-%d-%Y`" >> busybox-${VERSION}-branch_update-${PATCH_NUM}.patch
80echo "Initial Package Version: ${VERSION}" >> busybox-${VERSION}-branch_update-${PATCH_NUM}.patch
81echo "Origin: Upstream" >> busybox-${VERSION}-branch_update-${PATCH_NUM}.patch
82echo "Upstream Status: Applied" >> busybox-${VERSION}-branch_update-${PATCH_NUM}.patch
83echo "Description: This is a branch update for busybox-${VERSION}, and should be" >> busybox-${VERSION}-branch_update-${PATCH_NUM}.patch
84echo " rechecked periodically." >> busybox-${VERSION}-branch_update-${PATCH_NUM}.patch
85echo "" >> busybox-${VERSION}-branch_update-${PATCH_NUM}.patch
86diff -Naur busybox-${VERSION}.orig busybox-${VERSION} >> busybox-${VERSION}-branch_update-${PATCH_NUM}.patch
87echo "Created /usr/src/busybox-${VERSION}-branch_update-${PATCH_NUM}.patch."
Note: See TracBrowser for help on using the repository browser.