~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/patch-kernel

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/patch-kernel (Version linux-6.12-rc7) and /scripts/patch-kernel (Version linux-4.10.17)


  1 #! /bin/sh                                          1 #! /bin/sh
  2 # SPDX-License-Identifier: GPL-2.0             << 
  3 # Script to apply kernel patches.                   2 # Script to apply kernel patches.
  4 #   usage: patch-kernel [ sourcedir [ patchdir      3 #   usage: patch-kernel [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ]
  5 #     The source directory defaults to /usr/sr      4 #     The source directory defaults to /usr/src/linux, and the patch
  6 #     directory defaults to the current direct      5 #     directory defaults to the current directory.
  7 # e.g.                                              6 # e.g.
  8 #   scripts/patch-kernel . ..                       7 #   scripts/patch-kernel . ..
  9 #      Update the kernel tree in the current d      8 #      Update the kernel tree in the current directory using patches in the
 10 #      directory above to the latest Linus ker      9 #      directory above to the latest Linus kernel
 11 #   scripts/patch-kernel . .. -ac                  10 #   scripts/patch-kernel . .. -ac
 12 #      Get the latest Linux kernel and patch i     11 #      Get the latest Linux kernel and patch it with the latest ac patch
 13 #   scripts/patch-kernel . .. 2.4.9                12 #   scripts/patch-kernel . .. 2.4.9
 14 #      Gets standard kernel 2.4.9                  13 #      Gets standard kernel 2.4.9
 15 #   scripts/patch-kernel . .. 2.4.9 -ac            14 #   scripts/patch-kernel . .. 2.4.9 -ac
 16 #      Gets 2.4.9 with latest ac patches           15 #      Gets 2.4.9 with latest ac patches
 17 #   scripts/patch-kernel . .. 2.4.9 -ac11          16 #   scripts/patch-kernel . .. 2.4.9 -ac11
 18 #      Gets 2.4.9 with ac patch ac11               17 #      Gets 2.4.9 with ac patch ac11
 19 #   Note: It uses the patches relative to the      18 #   Note: It uses the patches relative to the Linus kernels, not the
 20 #   ac to ac relative patches                      19 #   ac to ac relative patches
 21 #                                                  20 #
 22 # It determines the current kernel version fro     21 # It determines the current kernel version from the top-level Makefile.
 23 # It then looks for patches for the next suble     22 # It then looks for patches for the next sublevel in the patch directory.
 24 # This is applied using "patch -p1 -s" from wi     23 # This is applied using "patch -p1 -s" from within the kernel directory.
 25 # A check is then made for "*.rej" files to se     24 # A check is then made for "*.rej" files to see if the patch was
 26 # successful.  If it is, then all of the "*.or     25 # successful.  If it is, then all of the "*.orig" files are removed.
 27 #                                                  26 #
 28 #       Nick Holloway <Nick.Holloway@alfie.demo     27 #       Nick Holloway <Nick.Holloway@alfie.demon.co.uk>, 2nd January 1995.
 29 #                                                  28 #
 30 # Added support for handling multiple types of     29 # Added support for handling multiple types of compression. What includes
 31 # gzip, bzip, bzip2, zip, compress, and plaint     30 # gzip, bzip, bzip2, zip, compress, and plaintext.
 32 #                                                  31 #
 33 #       Adam Sulmicki <adam@cfar.umd.edu>, 1st      32 #       Adam Sulmicki <adam@cfar.umd.edu>, 1st January 1997.
 34 #                                                  33 #
 35 # Added ability to stop at a given version num     34 # Added ability to stop at a given version number
 36 # Put the full version number (i.e. 2.3.31) as     35 # Put the full version number (i.e. 2.3.31) as the last parameter
 37 #       Dave Gilbert <linux@treblig.org>, 11th      36 #       Dave Gilbert <linux@treblig.org>, 11th December 1999.
 38                                                    37 
 39 # Fixed previous patch so that if we are alrea     38 # Fixed previous patch so that if we are already at the correct version
 40 # not to patch up.                                 39 # not to patch up.
 41 #                                                  40 #
 42 # Added -ac option, use -ac or -ac9 (say) to s     41 # Added -ac option, use -ac or -ac9 (say) to stop at a particular version
 43 #       Dave Gilbert <linux@treblig.org>, 29th      42 #       Dave Gilbert <linux@treblig.org>, 29th September 2001.
 44 #                                                  43 #
 45 # Add support for (use of) EXTRAVERSION (to su     44 # Add support for (use of) EXTRAVERSION (to support 2.6.8.x, e.g.);
 46 # update usage message;                            45 # update usage message;
 47 # fix some whitespace damage;                      46 # fix some whitespace damage;
 48 # be smarter about stopping when current versi     47 # be smarter about stopping when current version is larger than requested;
 49 #       Randy Dunlap <rdunlap@xenotime.net>, 20     48 #       Randy Dunlap <rdunlap@xenotime.net>, 2004-AUG-18.
 50 #                                                  49 #
 51 # Add better support for (non-incremental) 2.6     50 # Add better support for (non-incremental) 2.6.x.y patches;
 52 # If an ending version number if not specified     51 # If an ending version number if not specified, the script automatically
 53 # increments the SUBLEVEL (x in 2.6.x.y) until     52 # increments the SUBLEVEL (x in 2.6.x.y) until no more patch files are found;
 54 # however, EXTRAVERSION (y in 2.6.x.y) is neve     53 # however, EXTRAVERSION (y in 2.6.x.y) is never automatically incremented
 55 # but must be specified fully.                     54 # but must be specified fully.
 56 #                                                  55 #
 57 # patch-kernel does not normally support rever     56 # patch-kernel does not normally support reverse patching, but does so when
 58 # applying EXTRAVERSION (x.y) patches, so that     57 # applying EXTRAVERSION (x.y) patches, so that moving from 2.6.11.y to 2.6.11.z
 59 # is easy and handled by the script (reverse 2     58 # is easy and handled by the script (reverse 2.6.11.y and apply 2.6.11.z).
 60 #       Randy Dunlap <rdunlap@xenotime.net>, 20     59 #       Randy Dunlap <rdunlap@xenotime.net>, 2005-APR-08.
 61                                                    60 
 62 PNAME=patch-kernel                                 61 PNAME=patch-kernel
 63                                                    62 
 64 # Set directories from arguments, or use defau     63 # Set directories from arguments, or use defaults.
 65 sourcedir=${1-/usr/src/linux}                      64 sourcedir=${1-/usr/src/linux}
 66 patchdir=${2-.}                                    65 patchdir=${2-.}
 67 stopvers=${3-default}                              66 stopvers=${3-default}
 68                                                    67 
 69 if [ "$1" = -h -o "$1" = --help -o ! -r "$sour     68 if [ "$1" = -h -o "$1" = --help -o ! -r "$sourcedir/Makefile" ]; then
 70 cat << USAGE                                       69 cat << USAGE
 71 usage: $PNAME [-h] [ sourcedir [ patchdir [ st     70 usage: $PNAME [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ]
 72   source directory defaults to /usr/src/linux,     71   source directory defaults to /usr/src/linux,
 73   patch directory defaults to the current dire     72   patch directory defaults to the current directory,
 74   stopversion defaults to <all in patchdir>.       73   stopversion defaults to <all in patchdir>.
 75 USAGE                                              74 USAGE
 76 exit 1                                             75 exit 1
 77 fi                                                 76 fi
 78                                                    77 
 79 # See if we have any -ac options                   78 # See if we have any -ac options
 80 for PARM in $*                                     79 for PARM in $*
 81 do                                                 80 do
 82   case $PARM in                                    81   case $PARM in
 83           -ac*)                                    82           -ac*)
 84                   gotac=$PARM;                     83                   gotac=$PARM;
 85                                                    84 
 86         esac;                                      85         esac;
 87 done                                               86 done
 88                                                    87 
 89 # --------------------------------------------     88 # ---------------------------------------------------------------------------
 90 # arg1 is filename                                 89 # arg1 is filename
 91 noFile () {                                        90 noFile () {
 92         echo "cannot find patch file: ${patch}     91         echo "cannot find patch file: ${patch}"
 93         exit 1                                     92         exit 1
 94 }                                                  93 }
 95                                                    94 
 96 # --------------------------------------------     95 # ---------------------------------------------------------------------------
 97 backwards () {                                     96 backwards () {
 98         echo "$PNAME does not support reverse      97         echo "$PNAME does not support reverse patching"
 99         exit 1                                     98         exit 1
100 }                                                  99 }
101                                                   100 
102 # --------------------------------------------    101 # ---------------------------------------------------------------------------
103 # Find a file, first parameter is basename of     102 # Find a file, first parameter is basename of file
104 # it tries many compression mechanisms and set    103 # it tries many compression mechanisms and sets variables to say how to get it
105 findFile () {                                     104 findFile () {
106   filebase=$1;                                    105   filebase=$1;
107                                                   106 
108   if [ -r ${filebase}.gz ]; then                  107   if [ -r ${filebase}.gz ]; then
109                 ext=".gz"                         108                 ext=".gz"
110                 name="gzip"                       109                 name="gzip"
111                 uncomp="gunzip -dc"               110                 uncomp="gunzip -dc"
112   elif [ -r ${filebase}.bz  ]; then               111   elif [ -r ${filebase}.bz  ]; then
113                 ext=".bz"                         112                 ext=".bz"
114                 name="bzip"                       113                 name="bzip"
115                 uncomp="bunzip -dc"               114                 uncomp="bunzip -dc"
116   elif [ -r ${filebase}.bz2 ]; then               115   elif [ -r ${filebase}.bz2 ]; then
117                 ext=".bz2"                        116                 ext=".bz2"
118                 name="bzip2"                      117                 name="bzip2"
119                 uncomp="bunzip2 -dc"              118                 uncomp="bunzip2 -dc"
120   elif [ -r ${filebase}.xz ]; then                119   elif [ -r ${filebase}.xz ]; then
121                 ext=".xz"                         120                 ext=".xz"
122                 name="xz"                         121                 name="xz"
123                 uncomp="xz -dc"                   122                 uncomp="xz -dc"
124   elif [ -r ${filebase}.zip ]; then               123   elif [ -r ${filebase}.zip ]; then
125                 ext=".zip"                        124                 ext=".zip"
126                 name="zip"                        125                 name="zip"
127                 uncomp="unzip -d"                 126                 uncomp="unzip -d"
128   elif [ -r ${filebase}.Z ]; then                 127   elif [ -r ${filebase}.Z ]; then
129                 ext=".Z"                          128                 ext=".Z"
130                 name="uncompress"                 129                 name="uncompress"
131                 uncomp="uncompress -c"            130                 uncomp="uncompress -c"
132   elif [ -r ${filebase} ]; then                   131   elif [ -r ${filebase} ]; then
133                 ext=""                            132                 ext=""
134                 name="plaintext"                  133                 name="plaintext"
135                 uncomp="cat"                      134                 uncomp="cat"
136   else                                            135   else
137         return 1;                                 136         return 1;
138   fi                                              137   fi
139                                                   138 
140   return 0;                                       139   return 0;
141 }                                                 140 }
142                                                   141 
143 # --------------------------------------------    142 # ---------------------------------------------------------------------------
144 # Apply a patch and check it goes in cleanly      143 # Apply a patch and check it goes in cleanly
145 # First param is patch name (e.g. patch-2.4.9-    144 # First param is patch name (e.g. patch-2.4.9-ac5) - without path or extension
146                                                   145 
147 applyPatch () {                                   146 applyPatch () {
148   echo -n "Applying $1 (${name})... "             147   echo -n "Applying $1 (${name})... "
149   if $uncomp ${patchdir}/$1${ext} | patch -p1     148   if $uncomp ${patchdir}/$1${ext} | patch -p1 -s -N -E -d $sourcedir
150   then                                            149   then
151     echo "done."                                  150     echo "done."
152   else                                            151   else
153     echo "failed.  Clean up yourself."            152     echo "failed.  Clean up yourself."
154     return 1;                                     153     return 1;
155   fi                                              154   fi
156   if [ "`find $sourcedir/ '(' -name '*.rej' -o    155   if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
157   then                                            156   then
158     echo "Aborting.  Reject files found."         157     echo "Aborting.  Reject files found."
159     return 1;                                     158     return 1;
160   fi                                              159   fi
161   # Remove backup files                           160   # Remove backup files
162   find $sourcedir/ '(' -name '*.orig' -o -name    161   find $sourcedir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;
163                                                   162 
164   return 0;                                       163   return 0;
165 }                                                 164 }
166                                                   165 
167 # --------------------------------------------    166 # ---------------------------------------------------------------------------
168 # arg1 is patch filename                          167 # arg1 is patch filename
169 reversePatch () {                                 168 reversePatch () {
170         echo -n "Reversing $1 (${name}) ... "     169         echo -n "Reversing $1 (${name}) ... "
171         if $uncomp ${patchdir}/"$1"${ext} | pa    170         if $uncomp ${patchdir}/"$1"${ext} | patch -p1 -Rs -N -E -d $sourcedir
172         then                                      171         then
173                 echo "done."                      172                 echo "done."
174         else                                      173         else
175                 echo "failed.  Clean it up."      174                 echo "failed.  Clean it up."
176                 exit 1                            175                 exit 1
177         fi                                        176         fi
178         if [ "`find $sourcedir/ '(' -name '*.r    177         if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
179         then                                      178         then
180                 echo "Aborting.  Reject files     179                 echo "Aborting.  Reject files found."
181                 return 1                          180                 return 1
182         fi                                        181         fi
183         # Remove backup files                     182         # Remove backup files
184         find $sourcedir/ '(' -name '*.orig' -o    183         find $sourcedir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;
185                                                   184 
186         return 0                                  185         return 0
187 }                                                 186 }
188                                                   187 
189 # set current VERSION, PATCHLEVEL, SUBLEVEL, E    188 # set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
190 # force $TMPFILEs below to be in local directo    189 # force $TMPFILEs below to be in local directory: a slash character prevents
191 # the dot command from using the search path.     190 # the dot command from using the search path.
192 TMPFILE=`mktemp ./.tmpver.XXXXXX` || { echo "c    191 TMPFILE=`mktemp ./.tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
193 grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVE    192 grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE
194 tr -d [:blank:] < $TMPFILE > $TMPFILE.1           193 tr -d [:blank:] < $TMPFILE > $TMPFILE.1
195 . $TMPFILE.1                                      194 . $TMPFILE.1
196 rm -f $TMPFILE*                                   195 rm -f $TMPFILE*
197 if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "    196 if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
198 then                                              197 then
199     echo "unable to determine current kernel v    198     echo "unable to determine current kernel version" >&2
200     exit 1                                        199     exit 1
201 fi                                                200 fi
202                                                   201 
203 NAME=`grep ^NAME $sourcedir/Makefile`             202 NAME=`grep ^NAME $sourcedir/Makefile`
204 NAME=${NAME##*=}                                  203 NAME=${NAME##*=}
205                                                   204 
206 echo "Current kernel version is $VERSION.$PATC    205 echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} ($NAME)"
207                                                   206 
208 # strip EXTRAVERSION to just a number (drop le    207 # strip EXTRAVERSION to just a number (drop leading '.' and trailing additions)
209 EXTRAVER=                                         208 EXTRAVER=
210 if [ x$EXTRAVERSION != "x" ]                      209 if [ x$EXTRAVERSION != "x" ]
211 then                                              210 then
212         EXTRAVER=${EXTRAVERSION#.}                211         EXTRAVER=${EXTRAVERSION#.}
213         EXTRAVER=${EXTRAVER%%[[:punct:]]*}        212         EXTRAVER=${EXTRAVER%%[[:punct:]]*}
214         #echo "$PNAME: changing EXTRAVERSION f    213         #echo "$PNAME: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER"
215 fi                                                214 fi
216                                                   215 
217 #echo "stopvers=$stopvers"                        216 #echo "stopvers=$stopvers"
218 if [ $stopvers != "default" ]; then               217 if [ $stopvers != "default" ]; then
219         STOPSUBLEVEL=`echo $stopvers | cut -d.    218         STOPSUBLEVEL=`echo $stopvers | cut -d. -f3`
220         STOPEXTRA=`echo $stopvers | cut -d. -f    219         STOPEXTRA=`echo $stopvers | cut -d. -f4`
221         STOPFULLVERSION=${stopvers%%.$STOPEXTR    220         STOPFULLVERSION=${stopvers%%.$STOPEXTRA}
222         #echo "#___STOPSUBLEVEL=/$STOPSUBLEVEL    221         #echo "#___STOPSUBLEVEL=/$STOPSUBLEVEL/, STOPEXTRA=/$STOPEXTRA/"
223 else                                              222 else
224         STOPSUBLEVEL=9999                         223         STOPSUBLEVEL=9999
225         STOPEXTRA=9999                            224         STOPEXTRA=9999
226 fi                                                225 fi
227                                                   226 
228 # This all assumes a 2.6.x[.y] kernel tree.       227 # This all assumes a 2.6.x[.y] kernel tree.
229 # Don't allow backwards/reverse patching.         228 # Don't allow backwards/reverse patching.
230 if [ $STOPSUBLEVEL -lt $SUBLEVEL ]; then          229 if [ $STOPSUBLEVEL -lt $SUBLEVEL ]; then
231         backwards                                 230         backwards
232 fi                                                231 fi
233                                                   232 
234 if [ x$EXTRAVER != "x" ]; then                    233 if [ x$EXTRAVER != "x" ]; then
235         CURRENTFULLVERSION="$VERSION.$PATCHLEV    234         CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$EXTRAVER"
236 else                                              235 else
237         CURRENTFULLVERSION="$VERSION.$PATCHLEV    236         CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
238 fi                                                237 fi
239                                                   238 
240 if [ x$EXTRAVER != "x" ]; then                    239 if [ x$EXTRAVER != "x" ]; then
241         echo "backing up to: $VERSION.$PATCHLE    240         echo "backing up to: $VERSION.$PATCHLEVEL.$SUBLEVEL"
242         patch="patch-${CURRENTFULLVERSION}"       241         patch="patch-${CURRENTFULLVERSION}"
243         findFile $patchdir/${patch} || noFile     242         findFile $patchdir/${patch} || noFile ${patch}
244         reversePatch ${patch} || exit 1           243         reversePatch ${patch} || exit 1
245 fi                                                244 fi
246                                                   245 
247 # now current is 2.6.x, with no EXTRA applied,    246 # now current is 2.6.x, with no EXTRA applied,
248 # so update to target SUBLEVEL (2.6.SUBLEVEL)     247 # so update to target SUBLEVEL (2.6.SUBLEVEL)
249 # and then to target EXTRAVER (2.6.SUB.EXTRAVE    248 # and then to target EXTRAVER (2.6.SUB.EXTRAVER) if requested.
250 # If not ending sublevel is specified, it is i    249 # If not ending sublevel is specified, it is incremented until
251 # no further sublevels are found.                 250 # no further sublevels are found.
252                                                   251 
253 if [ $STOPSUBLEVEL -gt $SUBLEVEL ]; then          252 if [ $STOPSUBLEVEL -gt $SUBLEVEL ]; then
254 while :                         # incrementing    253 while :                         # incrementing SUBLEVEL (s in v.p.s)
255 do                                                254 do
256     CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$    255     CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
257     EXTRAVER=                                     256     EXTRAVER=
258     if [ x$STOPFULLVERSION = x$CURRENTFULLVERS    257     if [ x$STOPFULLVERSION = x$CURRENTFULLVERSION ]; then
259         echo "Stopping at $CURRENTFULLVERSION     258         echo "Stopping at $CURRENTFULLVERSION base as requested."
260         break                                     259         break
261     fi                                            260     fi
262                                                   261 
263     SUBLEVEL=$(($SUBLEVEL + 1))                   262     SUBLEVEL=$(($SUBLEVEL + 1))
264     FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVE    263     FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
265     #echo "#___ trying $FULLVERSION ___"          264     #echo "#___ trying $FULLVERSION ___"
266                                                   265 
267     if [ $(($SUBLEVEL)) -gt $(($STOPSUBLEVEL))    266     if [ $(($SUBLEVEL)) -gt $(($STOPSUBLEVEL)) ]; then
268         echo "Stopping since sublevel ($SUBLEV    267         echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)"
269         exit 1                                    268         exit 1
270     fi                                            269     fi
271                                                   270 
272     patch=patch-$FULLVERSION                      271     patch=patch-$FULLVERSION
273     # See if the file exists and find extensio    272     # See if the file exists and find extension
274     findFile $patchdir/${patch} || noFile ${pa    273     findFile $patchdir/${patch} || noFile ${patch}
275                                                   274 
276     # Apply the patch and check all is OK         275     # Apply the patch and check all is OK
277     applyPatch $patch || break                    276     applyPatch $patch || break
278 done                                              277 done
279 #echo "#___sublevel all done"                     278 #echo "#___sublevel all done"
280 fi                                                279 fi
281                                                   280 
282 # There is no incremental searching for extrav    281 # There is no incremental searching for extraversion...
283 if [ "$STOPEXTRA" != "" ]; then                   282 if [ "$STOPEXTRA" != "" ]; then
284 while :                         # just to allo    283 while :                         # just to allow break
285 do                                                284 do
286 # apply STOPEXTRA directly (not incrementally)    285 # apply STOPEXTRA directly (not incrementally) (x in v.p.s.x)
287         FULLVERSION="$VERSION.$PATCHLEVEL.$SUB    286         FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$STOPEXTRA"
288         #echo "#... trying $FULLVERSION ..."      287         #echo "#... trying $FULLVERSION ..."
289         patch=patch-$FULLVERSION                  288         patch=patch-$FULLVERSION
290                                                   289 
291         # See if the file exists and find exte    290         # See if the file exists and find extension
292         findFile $patchdir/${patch} || noFile     291         findFile $patchdir/${patch} || noFile ${patch}
293                                                   292 
294         # Apply the patch and check all is OK     293         # Apply the patch and check all is OK
295         applyPatch $patch || break                294         applyPatch $patch || break
296         #echo "#___extraver all done"             295         #echo "#___extraver all done"
297         break                                     296         break
298 done                                              297 done
299 fi                                                298 fi
300                                                   299 
301 if [ x$gotac != x ]; then                         300 if [ x$gotac != x ]; then
302   # Out great user wants the -ac patches          301   # Out great user wants the -ac patches
303         # They could have done -ac (get latest    302         # They could have done -ac (get latest) or -acxx where xx=version they want
304         if [ $gotac = "-ac" ]; then               303         if [ $gotac = "-ac" ]; then
305           # They want the latest version          304           # They want the latest version
306                 HIGHESTPATCH=0                    305                 HIGHESTPATCH=0
307                 for PATCHNAMES in $patchdir/pa    306                 for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.*
308                 do                                307                 do
309                         ACVALUE=`echo $PATCHNA    308                         ACVALUE=`echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-ac\([0-9]*\).*/\1/'`
310                         # Check it is actually    309                         # Check it is actually a recognised patch type
311                         findFile $patchdir/pat    310                         findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${ACVALUE} || break
312                                                   311 
313                   if [ $ACVALUE -gt $HIGHESTPA    312                   if [ $ACVALUE -gt $HIGHESTPATCH ]; then
314                           HIGHESTPATCH=$ACVALU    313                           HIGHESTPATCH=$ACVALUE
315                   fi                              314                   fi
316                 done                              315                 done
317                                                   316 
318                 if [ $HIGHESTPATCH -ne 0 ]; th    317                 if [ $HIGHESTPATCH -ne 0 ]; then
319                         findFile $patchdir/pat    318                         findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH} || break
320                         applyPatch patch-${CUR    319                         applyPatch patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH}
321                 else                              320                 else
322                   echo "No -ac patches found"     321                   echo "No -ac patches found"
323                 fi                                322                 fi
324         else                                      323         else
325           # They want an exact version            324           # They want an exact version
326                 findFile $patchdir/patch-${CUR    325                 findFile $patchdir/patch-${CURRENTFULLVERSION}${gotac} || {
327                   echo "Sorry, I couldn't find    326                   echo "Sorry, I couldn't find the $gotac patch for $CURRENTFULLVERSION.  Hohum."
328                         exit 1                    327                         exit 1
329                 }                                 328                 }
330                 applyPatch patch-${CURRENTFULL    329                 applyPatch patch-${CURRENTFULLVERSION}${gotac}
331         fi                                        330         fi
332 fi                                                331 fi
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php