Contents of /mcore-src/trunk/mcore-tools/src/modules/tigervnc/vnc.control.class.in
Parent Directory | Revision Log
Revision 2620 -
(show annotations)
(download)
Fri Sep 25 08:17:56 2015 UTC (8 years, 9 months ago) by niro
File size: 1723 byte(s)
Fri Sep 25 08:17:56 2015 UTC (8 years, 9 months ago) by niro
File size: 1723 byte(s)
-fail on unknown action
1 | # $Id$ |
2 | |
3 | push_config 80_vnc_service 80_vnc_passwd |
4 | |
5 | help_vnc_service() |
6 | { |
7 | local serial="${CLASS_ARGV[0]}" |
8 | control_client "${serial}" help system.reboot |
9 | } |
10 | |
11 | help_vnc_passwd() |
12 | { |
13 | local serial="${CLASS_ARGV[0]}" |
14 | control_client "${serial}" help system.reboot |
15 | } |
16 | |
17 | set_vnc_service() |
18 | { |
19 | local serial="${CLASS_ARGV[0]}" |
20 | local action="${CLASS_ARGV[1]}" |
21 | local value |
22 | |
23 | case "${action}" in |
24 | enable) value=1 ;; |
25 | disable) value=0 ;; |
26 | *) |
27 | eecho "Unknown action '${action}'" |
28 | return 1 |
29 | ;; |
30 | esac |
31 | |
32 | import_resource cfg_vnc "${serial}" service "${value}" |
33 | } |
34 | |
35 | control_vnc_service() |
36 | { |
37 | local serial="${CLASS_ARGV[0]}" |
38 | push_config_80_vnc_service "${serial}" |
39 | } |
40 | |
41 | set_vnc_passwd() |
42 | { |
43 | local serial="${CLASS_ARGV[0]}" |
44 | local value="${CLASS_ARGV[1]}" |
45 | |
46 | import_resource client_auth "${serial}" vnc "${value}" |
47 | } |
48 | |
49 | control_vnc_passwd() |
50 | { |
51 | local serial="${CLASS_ARGV[0]}" |
52 | push_config_80_vnc_passwd "${serial}" |
53 | } |
54 | |
55 | push_config_80_vnc_service() |
56 | { |
57 | local serial="$1" |
58 | local value |
59 | local action |
60 | |
61 | value=$(mysqldo "select service from cfg_vnc where serial='${serial}'") |
62 | if [[ -z ${value} ]] || [[ ${value} = NULL ]] |
63 | then |
64 | decho "retval NULL, not running 'control_client '${serial}' set vnc.service '${value}''" |
65 | else |
66 | case "${value}" in |
67 | 0) action="disable" ;; |
68 | 1) action="enable" ;; |
69 | *) |
70 | decho "Unknown value '${value}'" |
71 | return 1 |
72 | ;; |
73 | esac |
74 | |
75 | control_client "${serial}" set vnc.service "${action}" |
76 | fi |
77 | } |
78 | |
79 | push_config_80_vnc_passwd() |
80 | { |
81 | local serial="$1" |
82 | local value |
83 | |
84 | value=$(mysqldo "select vnc from client_auth where serial='${serial}'") |
85 | if [[ ${value} = NULL ]] |
86 | then |
87 | decho "retval NULL, not running 'control_client '${serial}' set vnc.passwd '${value}''" |
88 | else |
89 | control_client "${serial}" set vnc.passwd "${value}" |
90 | fi |
91 | } |