/[baselayout]/trunk/sbin/functions.sh
Gentoo

Diff of /trunk/sbin/functions.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 333 Revision 334
14 14
15# daemontools dir 15# daemontools dir
16SVCDIR="/var/lib/supervise" 16SVCDIR="/var/lib/supervise"
17 17
18# Check /etc/conf.d/rc for a description of these ... 18# Check /etc/conf.d/rc for a description of these ...
19svcdir="/var/state/init.d" 19svcdir="/var/lib/init.d"
20svcmount="no" 20svcmount="no"
21svcfstype="tmpfs" 21svcfstype="tmpfs"
22svcsize=1024 22svcsize=1024
23shmdir="/mnt/.shm" 23shmdir="/mnt/.shm"
24 24
327 killall -1 init 327 killall -1 init
328 328
329 eend 0 329 eend 0
330} 330}
331 331
332# char *KV_major(string)
333#
334# Return the Major version part of given kernel version.
335#
336KV_major() {
337 [ -z "$1" ] && return 1
338
339 local KV="`echo $1 | \
340 awk '{ tmp = $0; gsub(/^[0-9\.]*/, "", tmp); sub(tmp, ""); print }'`"
341 echo "${KV}" | cut -d. -f1
342}
343
344# char *KV_minor(string)
345#
346# Return the Minor version part of given kernel version.
347#
348KV_minor() {
349 [ -z "$1" ] && return 1
350
351 local KV="`echo $1 | \
352 awk '{ tmp = $0; gsub(/^[0-9\.]*/, "", tmp); sub(tmp, ""); print }'`"
353 echo "${KV}" | cut -d. -f2
354}
355
356# char *KV_micro(string)
357#
358# Return the Micro version part of given kernel version.
359#
360KV_micro() {
361 [ -z "$1" ] && return 1
362
363 local KV="`echo $1 | \
364 awk '{ tmp = $0; gsub(/^[0-9\.]*/, "", tmp); sub(tmp, ""); print }'`"
365 echo "${KV}" | cut -d. -f3
366}
367
332# int KV_to_int(string) 368# int KV_to_int(string)
333# 369#
334# Convert a string type kernel version (2.4.0) to an int (132096) 370# Convert a string type kernel version (2.4.0) to an int (132096)
335# for easy compairing or versions ... 371# for easy compairing or versions ...
336# 372#
337KV_to_int() { 373KV_to_int() {
338 [ -z "$1" ] && return 1 374 [ -z "$1" ] && return 1
339 375
340 local KV="`echo $1 | \ 376 local KV_MAJOR="`KV_major "$1"`"
341 awk '{ tmp = $0; gsub(/^[0-9\.]*/, "", tmp); sub(tmp, ""); print }'`" 377 local KV_MINOR="`KV_minor "$1"`"
342 local KV_MAJOR="`echo "${KV}" | cut -d. -f1`" 378 local KV_MICRO="`KV_micro "$1"`"
343 local KV_MINOR="`echo "${KV}" | cut -d. -f2`"
344 local KV_MICRO="`echo "${KV}" | cut -d. -f3`"
345 local KV_int="$((KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO))" 379 local KV_int="$((KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO))"
346 380
347 # We make version 2.2.0 the minimum version we will handle as 381 # We make version 2.2.0 the minimum version we will handle as
348 # a sanity check ... if its less, we fail ... 382 # a sanity check ... if its less, we fail ...
349 if [ "${KV_int}" -ge 131584 ] 383 if [ "${KV_int}" -ge 131584 ]

Legend:
Removed from v.333  
changed lines
  Added in v.334

  ViewVC Help
Powered by ViewVC 1.1.20