Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/daemon/client/include/sysvinit.client.class

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2088 - (show annotations) (download)
Fri May 10 13:20:27 2013 UTC (10 years, 11 months ago) by niro
File size: 1555 byte(s)
-disable some command which not work with $MROOT set
1 # $Id$
2
3 provide basic-init sysvinit
4 require basic-system
5
6 set_system_service()
7 {
8 local command="$1"
9 local service="$2"
10 local opts="$3"
11
12 [[ -z ${command} ]] && help_system_service && return 1
13 [[ -z ${service} ]] && help_system_service && return 1
14
15 if [[ ! -x ${MROOT}/etc/rc.d/init.d/${service} ]]
16 then
17 eecho "Service '${service}' unkown!"
18 return 1
19 fi
20
21 if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]]
22 then
23 case "${command}" in
24 start|stop|restart|reload)
25 eecho "Command not available while \$MROOT is set"
26 return 1
27 ;;
28 esac
29 fi
30
31 case "${command}" in
32 start) /etc/rc.d/init.d/"${service}" start ;;
33 stop) /etc/rc.d/init.d/"${service}" stop ;;
34 restart) /etc/rc.d/init.d/"${service}" restart ;;
35 reload) /etc/rc.d/init.d/"${service}" reload ;;
36 add) rc-config add "${service}" ;;
37 del) rc-config del "${service}" ;;
38 *) help_system_service && return ;;
39 esac
40 }
41
42 get_system_service()
43 {
44 local command="$1"
45 local service="$2"
46
47 [[ -z ${command} ]] && help_system_service && return 1
48 [[ -z ${service} ]] && help_system_service && return 1
49
50 if [[ ! -x ${MROOT}/etc/rc.d/init.d/${service} ]]
51 then
52 eecho "Service '${service}' unkown!"
53 return 1
54 fi
55
56 if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]]
57 then
58 case "${command}" in
59 status)
60 eecho "Command not available while \$MROOT is set"
61 return 1
62 ;;
63 esac
64 fi
65
66 case "${command}" in
67 status) /etc/rc.d/init.d/"${service}" status ;;
68 enabled) rc-config show "${service}" ;;
69 runlevel) eecho "function on todo" ;;
70 *) help_system_service && return ;;
71 esac
72 }