Magellan Linux

Diff of /trunk/initscripts/sysvinit/rc/functions

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

revision 147 by niro, Sun Jul 3 21:30:58 2005 UTC revision 1104 by niro, Wed Jul 14 14:31:47 2010 UTC
# Line 1  Line 1 
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 $  # $Id$
3    
4  # Begin $rc_base/init.d/functions - Run Level Control Functions  # Begin $rc_base/init.d/functions - Run Level Control Functions
5    
# Line 40  COLDEFAULT="\033[0m" Line 40  COLDEFAULT="\033[0m"
40    
41  COLOREDSTAR="${COLBLUE}(${COLGREEN}*${COLBLUE})${COLDEFAULT} "  COLOREDSTAR="${COLBLUE}(${COLGREEN}*${COLBLUE})${COLDEFAULT} "
42    
43  #location to save the started services  # location to save the started services
44  svcdir="/var/lib/init.d"  svcdir="/var/lib/init.d"
45  svclib="/lib/rcscripts"  svclib="/lib/rcscripts"
46  svcmount="no"  svcmount="no"
# Line 49  svcsize=1024 Line 49  svcsize=1024
49    
50    
51  # dummy function; needed if splashutils are not installed  # dummy function; needed if splashutils are not installed
52  splash() {  splash() { return 0; }
  return 0  
 }  
53    
54    # source splash functions if exists
 #source splash functions if exists  
55  [ -f /etc/init.d/splash-functions ] && source /etc/init.d/splash-functions  [ -f /etc/init.d/splash-functions ] && source /etc/init.d/splash-functions
56    
   
   
57  print_error_msg()  print_error_msg()
58  {  {
59   return 0   return 0
# Line 98  update_svcstatus() Line 93  update_svcstatus()
93   local SVCD_INITSCRIPT   local SVCD_INITSCRIPT
94   local x   local x
95    
   
96   #do this only if proc is mounted   #do this only if proc is mounted
97   [ ! -f /proc/mounts ] && return 0   [ ! -f /proc/mounts ] && return 0
98    
# Line 137  update_svcstatus() Line 131  update_svcstatus()
131    
132  evaluate_retval()  evaluate_retval()
133  {  {
134   error_value=$?   local error_value="$1"
135     [[ -z ${error_value} ]] && error_value=$?
136    
137   if [ $error_value = 0 ]   if [[ ${error_value} = 0 ]]
138   then   then
139   print_status success   print_status success
140   else   else
141   print_status failure   print_status failure
142   fi   fi
143    
144   return $error_value   return ${error_value}
145  }  }
146    
147  print_status()  print_status()
# Line 287  reloadproc() Line 282  reloadproc()
282   else   else
283   signal=${2##-}   signal=${2##-}
284   signal=${signal##SIG}   signal=${signal##SIG}
   
285   fi   fi
286    
287   getpids $1   getpids $1
# Line 348  progressbar() Line 342  progressbar()
342   fi   fi
343  }  }
344    
345    kernel_version()
346    {
347     local KV="$(uname -r | cut -d- -f1)"
348     echo "${KV}"
349    }
350    
351  kernel_major_version()  kernel_major_version()
352  {  {
353   local KV   local KV
354   KV="$(uname -r|cut -d. -f1-2)"   KV="$(uname -r | cut -d. -f1-2)"
355   echo "${KV}"   echo "${KV}"
356  }  }
357    
358  dolisting()  dolisting()
359  {  {
360   local x=   local x=
361   local y=   local y=
# Line 391  dolisting() Line 391  dolisting()
391  }  }
392    
393  # searches /proc/mounts for mounted fstypes (like ext3)  # searches /proc/mounts for mounted fstypes (like ext3)
394  is_fstype_mounted() {  is_fstype_mounted()
395    {
396   local filesys   local filesys
397   local i   local i
398   filesys=$1   filesys=$1
# Line 403  is_fstype_mounted() { Line 404  is_fstype_mounted() {
404  }  }
405    
406  # searches /proc/mounts for mounted fs names (like udev, proc)  # searches /proc/mounts for mounted fs names (like udev, proc)
407  is_fs_mounted() {  is_fs_mounted()
408    {
409   local filesys   local filesys
410   local i   local i
411   filesys=$1   filesys=$1
# Line 415  is_fs_mounted() { Line 417  is_fs_mounted() {
417  }  }
418    
419  # checks if kernel supports fs xy  # checks if kernel supports fs xy
420  kernel_supports_fs() {  kernel_supports_fs()
421    {
422   local filesys   local filesys
423   local i   local i
424   filesys=$1   filesys=$1
# Line 425  kernel_supports_fs() { Line 428  kernel_supports_fs() {
428    
429   return 0   return 0
430  }  }
431    
432    # bool is_older_than(reference, files/dirs to check)
433    #
434    #   return 0 if any of the files/dirs are newer than
435    #   the reference file
436    #
437    #   EXAMPLE: if is_older_than a.out *.o ; then ...
438    is_older_than()
439    {
440     local x=
441     local ref="$1"
442     shift
443    
444     for x in "$@"
445     do
446     [[ ${x} -nt ${ref} ]] && return 0
447    
448     if [[ -d ${x} ]]
449     then
450     is_older_than "${ref}" "${x}"/* && return 0
451     fi
452     done
453    
454     return 1
455    }
456    
457    start_devicemanager() { touch /dev/.none; return 0; }
458    stop_devicemanager() { return 0; }

Legend:
Removed from v.147  
changed lines
  Added in v.1104