Magellan Linux

Annotation of /mcore-src/trunk/mcore-tools/src/modules/basic-system/system.control.class.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2581 - (hide annotations) (download)
Thu Sep 17 12:56:08 2015 UTC (8 years, 7 months ago) by niro
File size: 1784 byte(s)
-added initial push_config support
1 niro 2531 # $Id$
2    
3 niro 2581 push_config 10_system_passwd
4    
5 niro 2531 help_system_reboot()
6     {
7     local serial="${CLASS_ARGV[0]}"
8     control_client "${serial}" help system.reboot
9     }
10    
11     control_system_reboot()
12     {
13     local serial="${CLASS_ARGV[0]}"
14     control_client "${serial}" set system.reboot
15     }
16    
17     help_system_shutdown()
18     {
19     local serial="${CLASS_ARGV[0]}"
20     control_client "${serial}" help system.shutdown
21     }
22    
23     control_system_shutdown()
24     {
25     local serial="${CLASS_ARGV[0]}"
26     control_client "${serial}" set system.shutdown
27     }
28    
29     help_system_console()
30     {
31     local serial="${CLASS_ARGV[0]}"
32     control_client "${serial}" help system.console
33     }
34    
35     control_system_console()
36     {
37     local serial="${CLASS_ARGV[0]}"
38     local user="${CLASS_ARGV[1]}"
39    
40     control_client "${serial}" set system.console "${user}"
41     }
42    
43     help_system_passwd()
44     {
45     local serial="${CLASS_ARGV[0]}"
46     control_client "${serial}" help system.passwd
47     }
48    
49     set_system_passwd()
50     {
51     local serial="${CLASS_ARGV[0]}"
52     local user="${CLASS_ARGV[1]}"
53     local pass="${CLASS_ARGV[2]}"
54     local column
55    
56     case "${user}" in
57     root) column="root" ;;
58     ${MCORE_UNPRIV_USER}) column="user" ;;
59     *) echo "Unknown user '${user}', aborting"; return 1 ;;
60     esac
61    
62     import_resource client_auth "${serial}" "${column}" "${pass}"
63     }
64    
65 niro 2581 control_client_system_passwd()
66 niro 2531 {
67     local serial="${CLASS_ARGV[0]}"
68 niro 2581 push_config_10_system_passwd "${serial}"
69     }
70    
71     push_config_10_system_passwd()
72     {
73     local serial="$1"
74     local user
75 niro 2531 local pass
76     local column
77    
78 niro 2581 for user in root ${MCORE_UNPRIV_USER}
79     do
80     case "${user}" in
81     root) column="root" ;;
82     ${MCORE_UNPRIV_USER}) column="user" ;;
83     esac
84 niro 2531
85 niro 2581 pass=$(mysqldo "select ${column} from client_auth where serial='${serial}'")
86     if [[ ${pass} = NULL ]]
87     then
88     decho "pass is 'NULL' for user '${user}', ignoring"
89     else
90     control_client "${serial}" set system.passwd "${user}" "${pass}"
91     fi
92     done
93 niro 2531 }