Magellan Linux

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

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

trunk/magellan-initscripts/etc/rc.d/init.d/functions revision 931 by niro, Thu Nov 5 12:57:14 2009 UTC trunk/initscripts/sysvinit/rc/functions revision 1893 by niro, Wed Aug 22 17:57:39 2012 UTC
# Line 17  KILLDELAY=3 Line 17  KILLDELAY=3
17    
18  COLUMNS=$(stty size)  COLUMNS=$(stty size)
19  COLUMNS=${COLUMNS##* }  COLUMNS=${COLUMNS##* }
20    if [[ -z ${COLUMNS} ]] || [[ ${COLUMNS} = 0 ]]
21    then
22     COLUMNS=80
23    fi
24  COL=$[ $COLUMNS - 10 ]  COL=$[ $COLUMNS - 10 ]
25  WCOL=$[ $COLUMNS - 30 ]  WCOL=$[ $COLUMNS - 30 ]
26  WWCOL=$[ $COLUMNS - 40 ]  WWCOL=$[ $COLUMNS - 40 ]
# Line 40  COLDEFAULT="\033[0m" Line 44  COLDEFAULT="\033[0m"
44    
45  COLOREDSTAR="${COLBLUE}(${COLGREEN}*${COLBLUE})${COLDEFAULT} "  COLOREDSTAR="${COLBLUE}(${COLGREEN}*${COLBLUE})${COLDEFAULT} "
46    
47  #location to save the started services  # location to save the started services
48  svcdir="/var/lib/init.d"  svcdir="/var/lib/init.d"
49  svclib="/lib/rcscripts"  svclib="/lib/rcscripts"
50  svcmount="no"  svcmount="no"
51  svcfstype="tmpfs"  svcfstype="tmpfs"
52  svcsize=1024  svcsize=1024
53    
54    rc_echo() { echo "$@"; }
55    rc_print() { rc_echo -e "${COLOREDSTAR}$@"; }
56    
57  # dummy function; needed if splashutils are not installed  # dummy function; needed if splashutils are not installed
58  splash() {  splash() { return 0; }
  return 0  
 }  
59    
60    # source splash functions if exists
 #source splash functions if exists  
61  [ -f /etc/init.d/splash-functions ] && source /etc/init.d/splash-functions  [ -f /etc/init.d/splash-functions ] && source /etc/init.d/splash-functions
62    
   
   
63  print_error_msg()  print_error_msg()
64  {  {
65   return 0   return 0
# Line 98  update_svcstatus() Line 99  update_svcstatus()
99   local SVCD_INITSCRIPT   local SVCD_INITSCRIPT
100   local x   local x
101    
   
102   #do this only if proc is mounted   #do this only if proc is mounted
103   [ ! -f /proc/mounts ] && return 0   [ ! -f /proc/mounts ] && return 0
104    
# Line 145  evaluate_retval() Line 145  evaluate_retval()
145   print_status success   print_status success
146   else   else
147   print_status failure   print_status failure
148    
149     if [[ ${SPLASH_VERBOSE_ON_ERRORS} = 1 ]]
150     then
151     splash "rc_verbose" "${runlevel}"
152     fi
153   fi   fi
154    
155   return ${error_value}   return ${error_value}
# Line 202  print_status() Line 207  print_status()
207    
208  getpids()  getpids()
209  {  {
210   base=${1##*/}   local base=${1##*/}
211   pidlist=$(pidof -o $$ -o $PPID -x $base)   local opts
212     if [[ $(readlink /bin/pidof) = *busybox ]]
213     then
214     opts=""
215     else
216     opts="-x"
217     fi
218     pidlist=$(pidof -o $$ -o $PPID ${opts} $base)
219  }  }
220    
221  loadproc()  loadproc()
# Line 265  killproc() Line 277  killproc()
277   done   done
278    
279   base=${1##*/}   base=${1##*/}
280   if [ $failure = 0 ]; then rm -f /var/run/$base.pid; fi   if [ $failure = 0 ]; then rm -f /run/$base.pid; fi
281    
282   (exit $failure)   (exit $failure)
283   evaluate_retval   evaluate_retval
# Line 288  reloadproc() Line 300  reloadproc()
300   else   else
301   signal=${2##-}   signal=${2##-}
302   signal=${signal##SIG}   signal=${signal##SIG}
   
303   fi   fi
304    
305   getpids $1   getpids $1
# Line 325  statusproc() Line 336  statusproc()
336   then   then
337   echo "$base is running with Process ID(s) $pidlist"   echo "$base is running with Process ID(s) $pidlist"
338   else   else
339   if [ -s /var/run/$base.pid ]   if [ -s /run/$base.pid ]
340   then   then
341   echo "$1 is not running but /var/run/$base.pid exists"   echo "$1 is not running but /run/$base.pid exists"
342   return 1   return 1
343   else   else
344   echo "$1 is not running"   echo "$1 is not running"
# Line 398  dolisting() Line 409  dolisting()
409  }  }
410    
411  # searches /proc/mounts for mounted fstypes (like ext3)  # searches /proc/mounts for mounted fstypes (like ext3)
412  is_fstype_mounted() {  is_fstype_mounted()
413    {
414   local filesys   local filesys
415   local i   local i
416   filesys=$1   filesys=$1
# Line 410  is_fstype_mounted() { Line 422  is_fstype_mounted() {
422  }  }
423    
424  # searches /proc/mounts for mounted fs names (like udev, proc)  # searches /proc/mounts for mounted fs names (like udev, proc)
425  is_fs_mounted() {  is_fs_mounted()
426    {
427   local filesys   local filesys
428   local i   local i
429   filesys=$1   filesys=$1
# Line 422  is_fs_mounted() { Line 435  is_fs_mounted() {
435  }  }
436    
437  # checks if kernel supports fs xy  # checks if kernel supports fs xy
438  kernel_supports_fs() {  kernel_supports_fs()
439    {
440   local filesys   local filesys
441   local i   local i
442   filesys=$1   filesys=$1
# Line 439  kernel_supports_fs() { Line 453  kernel_supports_fs() {
453  #   the reference file  #   the reference file
454  #  #
455  #   EXAMPLE: if is_older_than a.out *.o ; then ...  #   EXAMPLE: if is_older_than a.out *.o ; then ...
456  is_older_than() {  is_older_than()
457    {
458   local x=   local x=
459   local ref="$1"   local ref="$1"
460   shift   shift
# Line 456  is_older_than() { Line 471  is_older_than() {
471    
472   return 1   return 1
473  }  }
474    
475    # read /etc/os-release file
476    # read_os_release $item
477    read_os_release()
478    {
479     local NAME
480     local ID
481     local Version
482     local Version_ID
483     local PRETTY_NAME
484     local ANSI_COLOR
485     local CPE_NAME
486    
487     if [[ -f /etc/os-release ]]
488     then
489     source /etc/os-release
490    
491     case $1 in
492     name) echo "${NAME}" ;;
493     id) echo "${ID}" ;;
494     version) echo "${Version}" ;;
495     version_id) echo "${Version_ID}" ;;
496     pretty_name) echo "${PRETTY_NAME}" ;;
497     ansi_color) echo "${ANSI_COLOR}" ;;
498     cpe_name) echo "${CPE_NAME}" ;;
499     esac
500     fi
501    }
502    
503    start_devicemanager() { touch /dev/.none; return 0; }
504    stop_devicemanager() { return 0; }

Legend:
Removed from v.931  
changed lines
  Added in v.1893