Magellan Linux

Diff of /branches/magellan-next/include/mtools.minc

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

revision 16 by niro, Thu Jun 2 17:44:13 2011 UTC revision 18 by niro, Thu Jun 2 18:16:14 2011 UTC
# Line 1  Line 1 
1  # $Header: /magellan-cvs/mage/include/mtools.minc,v 1.3 2008/02/10 12:13:56 niro Exp $  # $Id$
2    
3  # adds services to runlevels and starts them  # adds services to runlevels and starts them
4  # mstartservice service {/path/to/service_exec}  # mstartservice service {/path/to/service_exec}
# Line 7  mstartservice() Line 7  mstartservice()
7   local service="$1"   local service="$1"
8   local service_exec="$2"   local service_exec="$2"
9    
10     # only run if sysV init was found
11     if [[ ! -f /etc/rc.d/init.d/functions ]]
12     then
13     echo "sysV init not found, not adding service ${service} to runlevels!"
14     return
15     fi
16    
17   [[ -z ${service_exec} ]] && service_exec="$(which ${service})"   [[ -z ${service_exec} ]] && service_exec="$(which ${service})"
18    
19   # add service to default runlevels   # add service to default runlevels
# Line 35  mstopservice() Line 42  mstopservice()
42   local service="$1"   local service="$1"
43   local service_exec="$2"   local service_exec="$2"
44    
45     # only run if sysV init was found
46     if [[ ! -f /etc/rc.d/init.d/functions ]]
47     then
48     echo "sysV init not found, not adding service ${service} to runlevels!"
49     return
50     fi
51    
52   [[ -z ${service_exec} ]] && service_exec="$(which ${service} 2> /dev/null)"   [[ -z ${service_exec} ]] && service_exec="$(which ${service} 2> /dev/null)"
53    
54   # only stop the service if ${service_exec} does not exist   # only stop the service if ${service_exec} does not exist
# Line 64  mreloadservice() Line 78  mreloadservice()
78   local service="$1"   local service="$1"
79   local service_exec="$2"   local service_exec="$2"
80    
81     # only run if sysV init was found
82     if [[ ! -f /etc/rc.d/init.d/functions ]]
83     then
84     echo "sysV init not found, not adding service ${service} to runlevels!"
85     return
86     fi
87    
88   [[ -z ${service_exec} ]] && service_exec="$(which ${service} 2> /dev/null)"   [[ -z ${service_exec} ]] && service_exec="$(which ${service} 2> /dev/null)"
89    
90   # do not stop services on bootstrap or MROOT!=/   # do not stop services on bootstrap or MROOT!=/
# Line 93  mstartunit() Line 114  mstartunit()
114   fi   fi
115    
116   # we do not support $MROOT atm   # we do not support $MROOT atm
117   if [[ ${MROOT} != / ]] || [[ ! -z ${MROOT} ]]   if [[ ${MROOT} != / ]] && [[ ! -z ${MROOT} ]]
118   then   then
119   echo "\$MROOT is set, doing nothing!"   echo "\$MROOT is set, doing nothing!"
120   echo "Please add unit ${service} manually to the runlevels!"   echo "Please add unit ${service} manually to the runlevels!"
# Line 132  mstopunit() Line 153  mstopunit()
153   fi   fi
154    
155   # we do not support $MROOT atm   # we do not support $MROOT atm
156   if [[ ${MROOT} != / ]] || [[ ! -z ${MROOT} ]]   if [[ ${MROOT} != / ]] && [[ ! -z ${MROOT} ]]
157   then   then
158   echo "\$MROOT is set, doing nothing!"   echo "\$MROOT is set, doing nothing!"
159   echo "Please remove unit ${service} manually from the runlevels!"   echo "Please remove unit ${service} manually from the runlevels!"
# Line 180  mreloadunit() Line 201  mreloadunit()
201   fi   fi
202    
203   # we do not support $MROOT atm   # we do not support $MROOT atm
204   if [[ ${MROOT} != / ]] || [[ ! -z ${MROOT} ]]   if [[ ${MROOT} != / ]] && [[ ! -z ${MROOT} ]]
205   then   then
206   echo "\$MROOT is set, doing nothing!"   echo "\$MROOT is set, doing nothing!"
207   echo "Please remove unit ${service} manually from the runlevels!"   echo "Please remove unit ${service} manually from the runlevels!"

Legend:
Removed from v.16  
changed lines
  Added in v.18