aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/patch-kernel
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/patch-kernel')
-rwxr-xr-xscripts/patch-kernel22
1 files changed, 10 insertions, 12 deletions
diff --git a/scripts/patch-kernel b/scripts/patch-kernel
index 67e4b1868e50..ece46ef0ba54 100755
--- a/scripts/patch-kernel
+++ b/scripts/patch-kernel
@@ -65,7 +65,7 @@ sourcedir=${1-/usr/src/linux}
65patchdir=${2-.} 65patchdir=${2-.}
66stopvers=${3-default} 66stopvers=${3-default}
67 67
68if [ "$1" == -h -o "$1" == --help -o ! -r "$sourcedir/Makefile" ]; then 68if [ "$1" = -h -o "$1" = --help -o ! -r "$sourcedir/Makefile" ]; then
69cat << USAGE 69cat << USAGE
70usage: $PNAME [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ] 70usage: $PNAME [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ]
71 source directory defaults to /usr/src/linux, 71 source directory defaults to /usr/src/linux,
@@ -182,10 +182,12 @@ reversePatch () {
182} 182}
183 183
184# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION 184# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
185TMPFILE=`mktemp .tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; } 185# force $TMPFILEs below to be in local directory: a slash character prevents
186# the dot command from using the search path.
187TMPFILE=`mktemp ./.tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
186grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE 188grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE
187tr -d [:blank:] < $TMPFILE > $TMPFILE.1 189tr -d [:blank:] < $TMPFILE > $TMPFILE.1
188source $TMPFILE.1 190. $TMPFILE.1
189rm -f $TMPFILE* 191rm -f $TMPFILE*
190if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ] 192if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
191then 193then
@@ -202,11 +204,7 @@ echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} ($
202EXTRAVER= 204EXTRAVER=
203if [ x$EXTRAVERSION != "x" ] 205if [ x$EXTRAVERSION != "x" ]
204then 206then
205 if [ ${EXTRAVERSION:0:1} == "." ]; then 207 EXTRAVER=${EXTRAVERSION#.}
206 EXTRAVER=${EXTRAVERSION:1}
207 else
208 EXTRAVER=$EXTRAVERSION
209 fi
210 EXTRAVER=${EXTRAVER%%[[:punct:]]*} 208 EXTRAVER=${EXTRAVER%%[[:punct:]]*}
211 #echo "$PNAME: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER" 209 #echo "$PNAME: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER"
212fi 210fi
@@ -251,16 +249,16 @@ while : # incrementing SUBLEVEL (s in v.p.s)
251do 249do
252 CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" 250 CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
253 EXTRAVER= 251 EXTRAVER=
254 if [ $stopvers == $CURRENTFULLVERSION ]; then 252 if [ $stopvers = $CURRENTFULLVERSION ]; then
255 echo "Stopping at $CURRENTFULLVERSION base as requested." 253 echo "Stopping at $CURRENTFULLVERSION base as requested."
256 break 254 break
257 fi 255 fi
258 256
259 SUBLEVEL=$((SUBLEVEL + 1)) 257 SUBLEVEL=$(($SUBLEVEL + 1))
260 FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" 258 FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
261 #echo "#___ trying $FULLVERSION ___" 259 #echo "#___ trying $FULLVERSION ___"
262 260
263 if [ $((SUBLEVEL)) -gt $((STOPSUBLEVEL)) ]; then 261 if [ $(($SUBLEVEL)) -gt $(($STOPSUBLEVEL)) ]; then
264 echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)" 262 echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)"
265 exit 1 263 exit 1
266 fi 264 fi
@@ -297,7 +295,7 @@ fi
297if [ x$gotac != x ]; then 295if [ x$gotac != x ]; then
298 # Out great user wants the -ac patches 296 # Out great user wants the -ac patches
299 # They could have done -ac (get latest) or -acxx where xx=version they want 297 # They could have done -ac (get latest) or -acxx where xx=version they want
300 if [ $gotac == "-ac" ]; then 298 if [ $gotac = "-ac" ]; then
301 # They want the latest version 299 # They want the latest version
302 HIGHESTPATCH=0 300 HIGHESTPATCH=0
303 for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.* 301 for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.*