Magellan Linux

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

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

revision 1329 by niro, Mon Feb 14 17:59:46 2011 UTC revision 2037 by niro, Wed Apr 17 14:14:35 2013 UTC
# Line 31  help_system_console() Line 31  help_system_console()
31   mecho "set system.console [user]"   mecho "set system.console [user]"
32   mecho " Opens a console with user or root privileges."   mecho " Opens a console with user or root privileges."
33   mecho " Known users:"   mecho " Known users:"
34   mecho "   mcore  - mcore standard user only with user privileges"   mecho "   ${MCORE_UNPRIV_USER}  - mcore standard user only with user privileges"
35   mecho "   root   - mcore root user with full system privileges"   mecho "   root   - mcore root user with full system privileges"
36  }  }
37    
# Line 39  help_system_passwd() Line 39  help_system_passwd()
39  {  {
40   mecho "set system.passwd [user] [password]"   mecho "set system.passwd [user] [password]"
41   mecho " Sets a system password for given user."   mecho " Sets a system password for given user."
42   mecho "  Allowed users: mcore, root"   mecho "  Allowed users: ${MCORE_UNPRIV_USER}, root"
43   mecho "  If password is empty, the current password will be deleted."   mecho "  If password is empty, the current password will be deleted."
44  }  }
45    
# Line 61  set_system_console() Line 61  set_system_console()
61   [[ -z ${user} ]] && help_system_console && return 1   [[ -z ${user} ]] && help_system_console && return 1
62    
63   case "${user}" in   case "${user}" in
64   mcore) x11runas "rxvt &" ;;   ${MCORE_UNPRIV_USER}) x11runas "rxvt &" ;;
65   root)  x11runas "rxvt -T 'Login as root' -e /bin/bash -c 'echo \"Login as root\";exec /bin/login root' &" ;;   root)  x11runas "rxvt -T 'Login as root' -e /bin/bash -c 'echo \"Login as root\";exec /bin/login root' &" ;;
66   *)     help_system_console && return 1 ;;   *)     help_system_console && return 1 ;;
67   esac   esac
# Line 72  help_system_service() Line 72  help_system_service()
72   mecho "set system.service [command] [service] [opts]"   mecho "set system.service [command] [service] [opts]"
73   mecho " Controls system services."   mecho " Controls system services."
74   mecho " Commands:"   mecho " Commands:"
75     mecho "   status  - prints status of given service"
76   mecho "   start   - starts given service"   mecho "   start   - starts given service"
77   mecho "   stop    - stops given service"   mecho "   stop    - stops given service"
78   mecho "   restart - restart given service"   mecho "   restart - restart given service"
# Line 89  set_system_service() Line 90  set_system_service()
90   [[ -z ${command} ]] && help_system_service && return 1   [[ -z ${command} ]] && help_system_service && return 1
91   [[ -z ${service} ]] && help_system_service && return 1   [[ -z ${service} ]] && help_system_service && return 1
92    
93   if [[ ! -x /etc/rc.d/init.d/${service} ]]   if [[ ! -x ${MROOT}/etc/rc.d/init.d/${service} ]]
94   then   then
95   mecho "Service '${service}' unkown!"   eecho "Service '${service}' unkown!"
96   fi   fi
97    
98   case "${command}" in   case "${command}" in
# Line 99  set_system_service() Line 100  set_system_service()
100   stop) /etc/rc.d/init.d/"${service}" stop ;;   stop) /etc/rc.d/init.d/"${service}" stop ;;
101   restart) /etc/rc.d/init.d/"${service}" restart ;;   restart) /etc/rc.d/init.d/"${service}" restart ;;
102   reload) /etc/rc.d/init.d/"${service}" reload ;;   reload) /etc/rc.d/init.d/"${service}" reload ;;
103     status) /etc/rc.d/init.d/"${service}" status ;;
104   add) rc-config add "${service}" ;;   add) rc-config add "${service}" ;;
105   del) rc-config del "${service}" ;;   del) rc-config del "${service}" ;;
106   *) help_system_service && return ;;   *) help_system_service && return ;;
# Line 114  set_system_passwd() Line 116  set_system_passwd()
116   [[ -z ${pass} ]] && mecho "deleting password!"   [[ -z ${pass} ]] && mecho "deleting password!"
117    
118   case "${user}" in   case "${user}" in
119   root|mcore) (echo "${pass}"; sleep 0.1; echo "${pass}") | passwd "${user}" ;;   root|${MCORE_UNPRIV_USER}) (echo "${pass}"; sleep 0.1; echo "${pass}") | passwd "${user}" ;;
120   *) help_system_passwd && return 1 ;;   *) help_system_passwd && return 1 ;;
121   esac   esac
122  }  }
# Line 146  get_system_vt() Line 148  get_system_vt()
148  {  {
149   local tty   local tty
150   tty="$(fgconsole)"   tty="$(fgconsole)"
151   mecho "${tty}"   rvecho "${tty}"
152  }  }
153    
154  get_system_autologon()  get_system_autologon()
# Line 154  get_system_autologon() Line 156  get_system_autologon()
156   local var   local var
157   var=$(grep auto_login /etc/slim.conf | sed 's:auto_login.*\([yn].*\):\1:')   var=$(grep auto_login /etc/slim.conf | sed 's:auto_login.*\([yn].*\):\1:')
158   case "${var}" in   case "${var}" in
159   yes) mecho "autologon currently enabled" ;;   yes) mecho "autologon currently enabled"; rvecho "1" ;;
160   no) mecho "autologon currently disabled" ;;   no) mecho "autologon currently disabled"; rvecho "0" ;;
161   *) eecho "unkown state" ;;   *) eecho "unkown state" ;;
162   esac   esac
163  }  }
164    
165  set_system_autologon()  set_system_autologon()
166  {  {
167   local action   local action="$1"
168   [[ -z ${action} ]] && help_system_autologon && return 1   [[ -z ${action} ]] && help_system_autologon && return 1
169    
170   ## splash X11 tty too?   ## splash X11 tty too?
171    
172   case "${action}" in   case "${action}" in
173   enable)   enable)
174   sed 's:^auto_login.*:\1\tyes' /etc/slim.conf   sed -i 's:^\(auto_login\).*:\1\tyes:' /etc/slim.conf
175   mecho "autologon enabled"   mecho "autologon enabled"
176   ;;   ;;
177   disable)   disable)
178   sed 's:^auto_login.*:\1\tno' /etc/slim.conf   sed -i 's:^\(auto_login\).*:\1\tno:' /etc/slim.conf
179   mecho "autologon disabled"   mecho "autologon disabled"
180   ;;   ;;
181   *) help_system_autologon && return 1 ;;   *) help_system_autologon && return 1 ;;

Legend:
Removed from v.1329  
changed lines
  Added in v.2037