1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/functions,v 1.4 2005-07-03 21:30:58 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/functions,v 1.6 2006-01-03 18:03:11 niro Exp $ |
3 |
|
|
4 |
# Begin $rc_base/init.d/functions - Run Level Control Functions |
# Begin $rc_base/init.d/functions - Run Level Control Functions |
5 |
|
|
348 |
fi |
fi |
349 |
} |
} |
350 |
|
|
351 |
|
kernel_version() |
352 |
|
{ |
353 |
|
local KV="$(uname -r | cut -d- -f1)" |
354 |
|
echo "${KV}" |
355 |
|
} |
356 |
|
|
357 |
kernel_major_version() |
kernel_major_version() |
358 |
{ |
{ |
359 |
local KV |
local KV |
360 |
KV="$(uname -r|cut -d. -f1-2)" |
KV="$(uname -r | cut -d. -f1-2)" |
361 |
echo "${KV}" |
echo "${KV}" |
362 |
} |
} |
363 |
|
|
364 |
dolisting() |
dolisting() |
365 |
{ |
{ |
366 |
local x= |
local x= |
367 |
local y= |
local y= |
431 |
|
|
432 |
return 0 |
return 0 |
433 |
} |
} |
434 |
|
|
435 |
|
# bool is_older_than(reference, files/dirs to check) |
436 |
|
# |
437 |
|
# return 0 if any of the files/dirs are newer than |
438 |
|
# the reference file |
439 |
|
# |
440 |
|
# EXAMPLE: if is_older_than a.out *.o ; then ... |
441 |
|
is_older_than() { |
442 |
|
local x= |
443 |
|
local ref="$1" |
444 |
|
shift |
445 |
|
|
446 |
|
for x in "$@" |
447 |
|
do |
448 |
|
[[ ${x} -nt ${ref} ]] && return 0 |
449 |
|
|
450 |
|
if [[ -d ${x} ]] |
451 |
|
then |
452 |
|
is_older_than "${ref}" "${x}"/* && return 0 |
453 |
|
fi |
454 |
|
done |
455 |
|
|
456 |
|
return 1 |
457 |
|
} |