Annotation of /mcore-src/trunk/mcore-tools/src/modules/tigervnc/vnc.control.class.in
Parent Directory | Revision Log
Revision 2763 -
(hide annotations)
(download)
Wed Feb 3 08:04:23 2016 UTC (8 years, 3 months ago) by niro
File size: 2265 byte(s)
Wed Feb 3 08:04:23 2016 UTC (8 years, 3 months ago) by niro
File size: 2265 byte(s)
-fixed spelling and whitespaces
1 | niro | 2616 | # $Id$ |
2 | |||
3 | niro | 2755 | push_firstboot 10_vnc_passwd |
4 | push_firstboot 80_vnc_service | ||
5 | |||
6 | niro | 2616 | push_config 80_vnc_service 80_vnc_passwd |
7 | |||
8 | help_vnc_service() | ||
9 | { | ||
10 | local serial="${CLASS_ARGV[0]}" | ||
11 | control_client "${serial}" help system.reboot | ||
12 | } | ||
13 | |||
14 | help_vnc_passwd() | ||
15 | { | ||
16 | local serial="${CLASS_ARGV[0]}" | ||
17 | control_client "${serial}" help system.reboot | ||
18 | } | ||
19 | |||
20 | set_vnc_service() | ||
21 | { | ||
22 | local serial="${CLASS_ARGV[0]}" | ||
23 | local action="${CLASS_ARGV[1]}" | ||
24 | local value | ||
25 | |||
26 | case "${action}" in | ||
27 | enable) value=1 ;; | ||
28 | disable) value=0 ;; | ||
29 | *) | ||
30 | eecho "Unknown action '${action}'" | ||
31 | return 1 | ||
32 | ;; | ||
33 | esac | ||
34 | |||
35 | import_resource cfg_vnc "${serial}" service "${value}" | ||
36 | } | ||
37 | |||
38 | control_vnc_service() | ||
39 | { | ||
40 | local serial="${CLASS_ARGV[0]}" | ||
41 | push_config_80_vnc_service "${serial}" | ||
42 | } | ||
43 | |||
44 | set_vnc_passwd() | ||
45 | { | ||
46 | local serial="${CLASS_ARGV[0]}" | ||
47 | local value="${CLASS_ARGV[1]}" | ||
48 | |||
49 | import_resource client_auth "${serial}" vnc "${value}" | ||
50 | } | ||
51 | |||
52 | control_vnc_passwd() | ||
53 | { | ||
54 | local serial="${CLASS_ARGV[0]}" | ||
55 | push_config_80_vnc_passwd "${serial}" | ||
56 | } | ||
57 | |||
58 | push_config_80_vnc_service() | ||
59 | { | ||
60 | local serial="$1" | ||
61 | local value | ||
62 | local action | ||
63 | |||
64 | value=$(mysqldo "select service from cfg_vnc where serial='${serial}'") | ||
65 | if [[ -z ${value} ]] || [[ ${value} = NULL ]] | ||
66 | then | ||
67 | niro | 2619 | decho "retval NULL, not running 'control_client '${serial}' set vnc.service '${value}''" |
68 | niro | 2616 | else |
69 | case "${value}" in | ||
70 | 0) action="disable" ;; | ||
71 | 1) action="enable" ;; | ||
72 | niro | 2620 | *) |
73 | decho "Unknown value '${value}'" | ||
74 | return 1 | ||
75 | ;; | ||
76 | niro | 2616 | esac |
77 | |||
78 | control_client "${serial}" set vnc.service "${action}" | ||
79 | fi | ||
80 | } | ||
81 | |||
82 | push_config_80_vnc_passwd() | ||
83 | { | ||
84 | local serial="$1" | ||
85 | local value | ||
86 | |||
87 | value=$(mysqldo "select vnc from client_auth where serial='${serial}'") | ||
88 | if [[ ${value} = NULL ]] | ||
89 | then | ||
90 | niro | 2619 | decho "retval NULL, not running 'control_client '${serial}' set vnc.passwd '${value}''" |
91 | niro | 2616 | else |
92 | niro | 2619 | control_client "${serial}" set vnc.passwd "${value}" |
93 | niro | 2616 | fi |
94 | } | ||
95 | niro | 2755 | |
96 | push_firstboot_80_vnc_service() | ||
97 | { | ||
98 | local serial="$1" | ||
99 | |||
100 | # enable vnc service | ||
101 | decho "enable vnc service" | ||
102 | import_resource cfg_vnc "${serial}" "service" "1" | ||
103 | } | ||
104 | |||
105 | push_firstboot_10_vnc_passwd() | ||
106 | { | ||
107 | local serial="$1" | ||
108 | |||
109 | niro | 2763 | # now setup some empty database entries if they do not exist |
110 | niro | 2755 | auth=$(mysqldo "select vnc from client_auth where serial=${serial};") |
111 | if [[ -z ${auth} ]] || [[ ${auth} = NULL ]] | ||
112 | then | ||
113 | decho "set empty vnc pass" | ||
114 | niro | 2763 | import_resource client_auth "${serial}" "vnc" "" |
115 | niro | 2755 | fi |
116 | } |