Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/systemd/systemd.client.class.in

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

mcore-src/trunk/mcore-tools/daemon/client/include/systemd.client.class revision 2079 by niro, Fri May 10 11:37:38 2013 UTC mcore-src/trunk/mcore-tools/src/modules/systemd/systemd.client.class.in revision 2243 by niro, Mon Jan 13 09:27:41 2014 UTC
# Line 12  set_system_service() Line 12  set_system_service()
12   [[ -z ${command} ]] && help_system_service && return 1   [[ -z ${command} ]] && help_system_service && return 1
13   [[ -z ${service} ]] && help_system_service && return 1   [[ -z ${service} ]] && help_system_service && return 1
14    
15   if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]]   local chrooted
16     if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]]
17   then   then
18   eecho "Service '${service}' unkown!"   chrooted="system_chroot"
19     case ${command} in
20     start|stop|restart|reload)
21     eecho "Command not available while \$MROOT is set"
22     return 1
23     ;;
24     esac
25     fi
26    
27     if [[ -n $(${chrooted} systemctl status ${service} | grep 'Reason: No such file or directory') ]]
28     then
29     eecho "Service '${service}' unknown!"
30   return 1   return 1
31   fi   fi
32    
33     # auto-append .service to fix issues while $MROOT is set
34     if [[ -n $(echo ${service} | grep -v '.service$\|.target$\|.mount$\|.socket$\|.timer$') ]]
35     then
36     service="${service}.service"
37     decho "\$service replaced with '${service}'"
38     fi
39    
40   case "${command}" in   case "${command}" in
41   start) systemctl start "${service}" ;;   start) ${chrooted} systemctl start "${service}" ;;
42   stop) systemctl stop "${service}" ;;   stop) ${chrooted} systemctl stop "${service}" ;;
43   restart) systemctl try-restart "${service}" ;;   restart) ${chrooted} systemctl try-restart "${service}" ;;
44   reload) systemctl reload-or-try-restart "${service}" ;;   reload) ${chrooted} systemctl reload-or-try-restart "${service}" ;;
45   add) systemctl enable "${service}" ;;   enable) ${chrooted} systemctl enable "${service}" ;;
46   del) systemctl disable "${service}" ;;   disable) ${chrooted} systemctl disable "${service}" ;;
47   *) help_system_service && return ;;   *) help_system_service && return ;;
48   esac   esac
49  }  }
# Line 37  get_system_service() Line 56  get_system_service()
56   [[ -z ${command} ]] && help_system_service && return 1   [[ -z ${command} ]] && help_system_service && return 1
57   [[ -z ${service} ]] && help_system_service && return 1   [[ -z ${service} ]] && help_system_service && return 1
58    
59   if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]]   local chrooted
60     if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]]
61     then
62     chrooted="system_chroot"
63     case ${command} in
64     status)
65     eecho "Command not available while \$MROOT is set"
66     return 1
67     ;;
68     esac
69     fi
70    
71     if [[ -n $(${chrooted} systemctl status ${service} | grep 'Reason: No such file or directory') ]]
72   then   then
73   eecho "Service '${service}' unkown!"   eecho "Service '${service}' unknown!"
74   return 1   return 1
75   fi   fi
76    
77   case "${command}" in   case "${command}" in
78   status) systemctl status "${service}" ;;   status) ${chrooted} systemctl status "${service}" ;;
79   enabled) systemctl is-enabled "${service}"; rvecho "$?" ;;   enabled) ${chrooted} systemctl is-enabled "${service}"; rvecho "$?" ;;
80   runlevel) rvecho "$(readline ${MROOT}/etc/systemd/system/default.target)" ;;   runlevel) rvecho "$(readline ${MROOT}@@SYSTEMDSYSTEMCONFDIR@@/default.target)" ;;
81   *) help_system_service && return ;;   *) help_system_service && return ;;
82   esac   esac
83  }  }

Legend:
Removed from v.2079  
changed lines
  Added in v.2243