Annotation of /mcore-src/trunk/mcore-tools/src/modules/rdesktop/rdesktop.control.class.in
Parent Directory | Revision Log
Revision 2726 -
(hide annotations)
(download)
Thu Jan 28 14:20:01 2016 UTC (8 years, 4 months ago) by niro
File size: 2826 byte(s)
Thu Jan 28 14:20:01 2016 UTC (8 years, 4 months ago) by niro
File size: 2826 byte(s)
-added rdesktop module
1 | niro | 2726 | # $Id$ |
2 | |||
3 | push_config 80_rdesktop_session | ||
4 | |||
5 | help_rdesktop_session() | ||
6 | { | ||
7 | local serial="${CLASS_ARGV[0]}" | ||
8 | control_client "${serial}" help rdesktop.session | ||
9 | } | ||
10 | |||
11 | set_rdesktop_session() | ||
12 | { | ||
13 | local serial="${CLASS_ARGV[0]}" | ||
14 | local action="${CLASS_ARGV[1]}" | ||
15 | local name="${CLASS_ARGV[2]}" | ||
16 | local session="${CLASS_ARGV[3]}" | ||
17 | local mode="${CLASS_ARGV[4]}" | ||
18 | local user="${CLASS_ARGV[5]}" | ||
19 | local domain="${CLASS_ARGV[6]}" | ||
20 | local password="${CLASS_ARGV[7]}" | ||
21 | local serverlist="${CLASS_ARGV[8]}" | ||
22 | local autostart="${CLASS_ARGV[9]}" | ||
23 | local id | ||
24 | local enabled | ||
25 | |||
26 | case "${action}" in | ||
27 | add) enabled=1 ;; | ||
28 | del) enabled=0 ;; | ||
29 | *) | ||
30 | eecho "Unknown action '${action}'" | ||
31 | return 1 | ||
32 | ;; | ||
33 | esac | ||
34 | |||
35 | if [[ -z ${name} ]] | ||
36 | then | ||
37 | eecho "No name given" | ||
38 | return 1 | ||
39 | fi | ||
40 | |||
41 | [[ -z ${autostart} ]] && autostart=0 | ||
42 | |||
43 | id=$(mysqldo "select id from cfg_sessions_rdesktop where serial='${serial}' and name='${name}';") | ||
44 | if [[ -n ${id} ]] | ||
45 | then | ||
46 | mysqldo "update cfg_sessions_rdesktop set name='${name}', session='${session}', filename='${filename}', username='${username}', domain='${domain}', password='${password}', serverlist='${serverlist}', autostart='${autostart}', enabled='${enabled}' where id=${id};" | ||
47 | else | ||
48 | mysqldo "insert into cfg_sessions_rdesktop(serial, name, session, filename, username, domain, password, serverlist, autostart, enabled) values('${serial}', '${name}', '${session}', ${store}', '${filename}', '${domain}', '${password}', '${serverlist}', '${autostart}', '${enabled}');" | ||
49 | fi | ||
50 | } | ||
51 | |||
52 | control_rdesktop_session() | ||
53 | { | ||
54 | local serial="${CLASS_ARGV[0]}" | ||
55 | push_config_80_rdesktop_session "${serial}" | ||
56 | } | ||
57 | |||
58 | push_config_80_rdesktop_session() | ||
59 | { | ||
60 | local serial="$1" | ||
61 | local values | ||
62 | local id | ||
63 | |||
64 | values=$(mysqldo "select id from cfg_rdesktop_citrix where serial='${serial}';") | ||
65 | for id in ${values} | ||
66 | do | ||
67 | evaluate_table_xml cfg_sessions_rdesktop "where serial='${serial}'" | ||
68 | if [[ -z ${cfg_sessions_rdesktop_server} ]] | ||
69 | then | ||
70 | eecho "Server must not be empty id->'${id}'" | ||
71 | continue | ||
72 | fi | ||
73 | if [[ -z ${cfg_sessions_rdesktop_enabled} ]] | ||
74 | then | ||
75 | eecho "Enabled must not be empty id->'${id}'" | ||
76 | continue | ||
77 | fi | ||
78 | if [[ ${cfg_sessions_rdesktop_enabled} = 1 ]] | ||
79 | then | ||
80 | control_client "${serial}" set rdesktop.session add "${cfg_sessions_rdesktop_name}" "${cfg_sessions_rdesktop_server}" "fullscreen" "${cfg_sessions_rdesktop_username}" "${cfg_sessions_rdesktop_domain}" "${cfg_sessions_rdesktop_password}" "${cfg_sessions_rdesktop_password_shell}" "${cfg_sessions_rdesktop_autostart}" | ||
81 | elif [[ ${cfg_sessions_rdesktop_enabled} = 0 ]] | ||
82 | then | ||
83 | control_client "${serial}" set rdesktop.session del "${cfg_sessions_rdesktop_name}" | ||
84 | # remove from database too | ||
85 | mysqldo "delete from cfg_sessions_rdesktop where id='${id}';" | ||
86 | else | ||
87 | eecho "unknown enabled value id->'${id}', cfg_sessions_rdesktop_enabled -> '${cfg_sessions_rdesktop_enabled}'" | ||
88 | return 1 | ||
89 | fi | ||
90 | done | ||
91 | } |