--- mcore-src/trunk/mcore-tools/daemon/client/include/system.client.class 2013/05/10 10:45:18 2075 +++ mcore-src/trunk/mcore-tools/daemon/client/include/system.client.class 2013/05/10 11:37:38 2079 @@ -1,6 +1,7 @@ # $Id$ provide basic-system +require basic-init help_system_reboot() { @@ -35,14 +36,6 @@ mecho " root - mcore root user with full system privileges" } -help_system_passwd() -{ - mecho "set system.passwd [user] [password]" - mecho " Sets a system password for given user." - mecho " Allowed users: ${MCORE_UNPRIV_USER}, root" - mecho " If password is empty, the current password will be deleted." -} - help_system_autologon() { mecho "get system.autologon" @@ -87,120 +80,12 @@ mecho " del - deletes a service from all runlevels" } -helper_set_system_service_sysvinit() -{ - local command="$1" - local service="$2" - local opts="$3" - - [[ -z ${command} ]] && help_system_service && return 1 - [[ -z ${service} ]] && help_system_service && return 1 - - if [[ ! -x ${MROOT}/etc/rc.d/init.d/${service} ]] - then - eecho "Service '${service}' unkown!" - return 1 - fi - - case "${command}" in - start) /etc/rc.d/init.d/"${service}" start ;; - stop) /etc/rc.d/init.d/"${service}" stop ;; - restart) /etc/rc.d/init.d/"${service}" restart ;; - reload) /etc/rc.d/init.d/"${service}" reload ;; - add) rc-config add "${service}" ;; - del) rc-config del "${service}" ;; - *) help_system_service && return ;; - esac -} - -helper_set_system_service_systemd() -{ - local command="$1" - local service="$2" - local opts="$3" - - [[ -z ${command} ]] && help_system_service && return 1 - [[ -z ${service} ]] && help_system_service && return 1 - - if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]] - then - eecho "Service '${service}' unkown!" - return 1 - fi - - case "${command}" in - start) systemctl start "${service}" ;; - stop) systemctl stop "${service}" ;; - restart) systemctl try-restart "${service}" ;; - reload) systemctl reload-or-try-restart "${service}" ;; - add) systemctl enable "${service}" ;; - del) systemctl disable "${service}" ;; - *) help_system_service && return ;; - esac -} - -set_system_service() -{ - if [[ -x $(type -P systemctl) ]] - then - helper_set_system_service_systemd $* - else - helper_set_system_service_sysvinit $* - fi -} - -helper_get_system_service_sysvinit() -{ - local command="$1" - local service="$2" - - [[ -z ${command} ]] && help_system_service && return 1 - [[ -z ${service} ]] && help_system_service && return 1 - - if [[ ! -x ${MROOT}/etc/rc.d/init.d/${service} ]] - then - eecho "Service '${service}' unkown!" - return 1 - fi - - case "${command}" in - status) /etc/rc.d/init.d/"${service}" status ;; - enabled) rc-config show "${service}" ;; - runlevel) eecho "function on todo" ;; - *) help_system_service && return ;; - esac -} - -helper_get_system_service_systemd() -{ - local command="$1" - local service="$2" - - [[ -z ${command} ]] && help_system_service && return 1 - [[ -z ${service} ]] && help_system_service && return 1 - - if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]] - then - eecho "Service '${service}' unkown!" - return 1 - fi - - case "${command}" in - status) systemctl status "${service}" ;; - enabled) systemctl is-enabled "${service}"; rvecho "$?" ;; - runlevel) rvecho "$(readline ${MROOT}/etc/systemd/system/default.target)" ;; - *) help_system_service && return ;; - esac -} - -get_system_service() +help_system_passwd() { - if [[ -x $(type -P systemctl) ]] - then - helper_get_system_service_systemd $* - else - helper_get_system_service_sysvinit $* - fi + mecho "set system.passwd [user] [password]" + mecho " Sets a system password for given user." + mecho " Allowed users: ${MCORE_UNPRIV_USER}, root" + mecho " If password is empty, the current password will be deleted." } set_system_passwd()