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 1262 by niro, Fri Feb 4 20:05:37 2011 UTC revision 1648 by niro, Thu Mar 10 18:15:47 2011 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    
46    help_system_autologon()
47    {
48     mecho "get system.autologon"
49     mecho "  Shows the state of autlogon"
50     mecho
51     mecho "set system.autologon [action]"
52     mecho " Enables or disables X11 autologins of the mcore user."
53     mecho "  Available actions:"
54     mecho "      enable  - enables autologon"
55     mecho "      disable - disables autologon"
56    }
57    
58  set_system_console()  set_system_console()
59  {  {
60   local user="$1"   local user="$1"
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 79  set_system_service() Line 91  set_system_service()
91    
92   if [[ ! -x /etc/rc.d/init.d/${service} ]]   if [[ ! -x /etc/rc.d/init.d/${service} ]]
93   then   then
94   mecho "Service '${service}' unkown!"   eecho "Service '${service}' unkown!"
95   fi   fi
96    
97   case "${command}" in   case "${command}" in
# Line 102  set_system_passwd() Line 114  set_system_passwd()
114   [[ -z ${pass} ]] && mecho "deleting password!"   [[ -z ${pass} ]] && mecho "deleting password!"
115    
116   case "${user}" in   case "${user}" in
117   root|mcore) (echo "${pass}"; sleep 0.1; echo "${pass}") | passwd "${user}" ;;   root|${MCORE_UNPRIV_USER}) (echo "${pass}"; sleep 0.1; echo "${pass}") | passwd "${user}" ;;
118   *) help_system_passwd && return 1 ;;   *) help_system_passwd && return 1 ;;
119   esac   esac
120  }  }
# Line 134  get_system_vt() Line 146  get_system_vt()
146  {  {
147   local tty   local tty
148   tty="$(fgconsole)"   tty="$(fgconsole)"
149   mecho "${tty}"   rvecho "${tty}"
150    }
151    
152    get_system_autologon()
153    {
154     local var
155     var=$(grep auto_login /etc/slim.conf | sed 's:auto_login.*\([yn].*\):\1:')
156     case "${var}" in
157     yes) mecho "autologon currently enabled"; rvecho "1" ;;
158     no) mecho "autologon currently disabled"; rvecho "0" ;;
159     *) eecho "unkown state" ;;
160     esac
161    }
162    
163    set_system_autologon()
164    {
165     local action="$1"
166     [[ -z ${action} ]] && help_system_autologon && return 1
167    
168     ## splash X11 tty too?
169    
170     case "${action}" in
171     enable)
172     sed -i 's:^\(auto_login\).*:\1\tyes:' /etc/slim.conf
173     mecho "autologon enabled"
174     ;;
175     disable)
176     sed -i 's:^\(auto_login\).*:\1\tno:' /etc/slim.conf
177     mecho "autologon disabled"
178     ;;
179     *) help_system_autologon && return 1 ;;
180     esac
181  }  }

Legend:
Removed from v.1262  
changed lines
  Added in v.1648