Annotation of /mcore-src/trunk/mcore-tools/src/modules/citrix/storefront.control.class.in
Parent Directory | Revision Log
Revision 2593 -
(hide annotations)
(download)
Fri Sep 18 12:24:18 2015 UTC (8 years, 7 months ago) by niro
File size: 4667 byte(s)
Fri Sep 18 12:24:18 2015 UTC (8 years, 7 months ago) by niro
File size: 4667 byte(s)
-added storefront-store cmd to add storefront stores via xml file to save a lot of time and workaround serveral issues with the new ica receiver
1 | niro | 2568 | # $Id$ |
2 | |||
3 | niro | 2593 | #push_config 70_storefront_store 80_storefront_session |
4 | push_config 80_storefront_session | ||
5 | niro | 2568 | |
6 | help_storefront_store() | ||
7 | { | ||
8 | local serial="${CLASS_ARGV[0]}" | ||
9 | control_client "${serial}" help storefront.store | ||
10 | } | ||
11 | |||
12 | help_storefront_session() | ||
13 | { | ||
14 | local serial="${CLASS_ARGV[0]}" | ||
15 | control_client "${serial}" help storefront.session | ||
16 | } | ||
17 | |||
18 | set_storefront_session() | ||
19 | { | ||
20 | local serial="${CLASS_ARGV[0]}" | ||
21 | local action="${CLASS_ARGV[1]}" | ||
22 | local name="${CLASS_ARGV[2]}" | ||
23 | local session="${CLASS_ARGV[3]}" | ||
24 | niro | 2593 | local store_uri="${CLASS_ARGV[4]}" |
25 | local user="${CLASS_ARGV[5]}" | ||
26 | local domain="${CLASS_ARGV[6]}" | ||
27 | local password="${CLASS_ARGV[7]}" | ||
28 | niro | 2568 | local id |
29 | local enabled | ||
30 | |||
31 | case "${action}" in | ||
32 | add) enabled=1 ;; | ||
33 | del) enabled=0 ;; | ||
34 | *) | ||
35 | eecho "Unknown action '${action}'" | ||
36 | return 1 | ||
37 | ;; | ||
38 | esac | ||
39 | |||
40 | if [[ -z ${name} ]] | ||
41 | then | ||
42 | eecho "No name given" | ||
43 | return 1 | ||
44 | fi | ||
45 | |||
46 | id=$(mysqldo "select id from cfg_sessions_storefront where serial='${serial}' and name='${name}';") | ||
47 | if [[ -n ${id} ]] | ||
48 | then | ||
49 | niro | 2593 | mysqldo "update cfg_sessions_storefront set name='${name}', session='${session}', store='${store_uri}', filename='${filename}', username='${username}', domain='${domain}', password='${password}', store='${store}', enabled='${enabled}' where id=${id};" |
50 | niro | 2568 | else |
51 | niro | 2593 | mysqldo "insert into cfg_fluxbox_menuitem(serial, name, session, store, filename, username, domain, password, store, enabled) values('${serial}', '${name}', '${session}', ${store_uri}', '${filename}', '${domain}', '${password}', '${store}', '${enabled}');" |
52 | niro | 2568 | fi |
53 | } | ||
54 | |||
55 | control_storefront_session() | ||
56 | { | ||
57 | local serial="${CLASS_ARGV[0]}" | ||
58 | niro | 2575 | push_config_80_storefront_session "${serial}" |
59 | niro | 2568 | } |
60 | |||
61 | niro | 2575 | push_config_80_storefront_session() |
62 | niro | 2568 | { |
63 | local serial="$1" | ||
64 | local values | ||
65 | local id | ||
66 | |||
67 | values=$(mysqldo "select id from cfg_sessions_storefront where serial='${serial}';") | ||
68 | for id in ${values} | ||
69 | do | ||
70 | evaluate_table_xml cfg_sessions_storefront "where serial='${serial}'" | ||
71 | niro | 2570 | if [[ -z ${cfg_sessions_storefront_session} ]] |
72 | niro | 2568 | then |
73 | niro | 2570 | eecho "Session must not be empty id->'${id}'" |
74 | niro | 2568 | continue |
75 | fi | ||
76 | if [[ -z ${cfg_sessions_storefront_enabled} ]] | ||
77 | then | ||
78 | eecho "Enabled must not be empty id->'${id}'" | ||
79 | continue | ||
80 | fi | ||
81 | if [[ ${cfg_sessions_storefront_enabled} = 1 ]] | ||
82 | then | ||
83 | niro | 2593 | control_client "${serial}" set storefront.session add "${cfg_sessions_storefront_name}" "${cfg_sessions_storefront_session}" "${cfg_sessions_storefront_store}" "${cfg_sessions_storefront_username}" "${cfg_sessions_storefront_domain} ${cfg_sessions_storefront_password}" |
84 | niro | 2568 | elif [[ ${cfg_sessions_storefront_enabled} = 0 ]] |
85 | then | ||
86 | control_client "${serial}" set storefront.session del "${cfg_sessions_storefront_name}" | ||
87 | # remove from database too | ||
88 | mysqldo "delete from cfg_sessions_storefront where id='${id}';" | ||
89 | else | ||
90 | eecho "unknown enabled value id->'${id}', cfg_sessions_storefront_enabled -> '${cfg_sessions_storefront_enabled}'" | ||
91 | return 1 | ||
92 | fi | ||
93 | done | ||
94 | } | ||
95 | |||
96 | set_storefront_store() | ||
97 | { | ||
98 | local serial="${CLASS_ARGV[0]}" | ||
99 | local action="${CLASS_ARGV[1]}" | ||
100 | local store="${CLASS_ARGV[2]}" | ||
101 | local id | ||
102 | local enabled | ||
103 | |||
104 | case "${action}" in | ||
105 | add) enabled=1 ;; | ||
106 | del) enabled=0 ;; | ||
107 | *) | ||
108 | eecho "Unknown action '${action}'" | ||
109 | return 1 | ||
110 | ;; | ||
111 | esac | ||
112 | |||
113 | if [[ -z ${store} ]] | ||
114 | then | ||
115 | eecho "No store given" | ||
116 | return 1 | ||
117 | fi | ||
118 | |||
119 | id=$(mysqldo "select id from cfg_storefront_store where serial='${serial}' and store='${store}';") | ||
120 | if [[ -n ${id} ]] | ||
121 | then | ||
122 | mysqldo "update cfg_storefront_store set store='${store}', enabled='${enabled}' where id=${id};" | ||
123 | else | ||
124 | mysqldo "insert into cfg_fluxbox_menuitem(serial, store, enabled) values('${serial}', '${store}', '${enabled}');" | ||
125 | fi | ||
126 | } | ||
127 | |||
128 | control_storefront_store() | ||
129 | { | ||
130 | local serial="${CLASS_ARGV[0]}" | ||
131 | niro | 2575 | push_config_70_storefront_store "${serial}" |
132 | niro | 2568 | } |
133 | |||
134 | niro | 2575 | push_config_70_storefront_store() |
135 | niro | 2568 | { |
136 | local serial="$1" | ||
137 | local values | ||
138 | local id | ||
139 | |||
140 | values=$(mysqldo "select id from cfg_storefront_store where serial='${serial}';") | ||
141 | for id in ${values} | ||
142 | do | ||
143 | evaluate_table_xml cfg_storefront_store "where serial='${serial}'" | ||
144 | if [[ -z ${cfg_storefront_store_store} ]] | ||
145 | then | ||
146 | eecho "Store must not be empty id->'${id}'" | ||
147 | continue | ||
148 | fi | ||
149 | if [[ -z ${cfg_storefront_store_enabled} ]] | ||
150 | then | ||
151 | eecho "Enabled must not be empty id->'${id}'" | ||
152 | continue | ||
153 | fi | ||
154 | if [[ ${cfg_storefront_store_enabled} = 1 ]] | ||
155 | then | ||
156 | control_client "${serial}" set storefront.store add "${cfg_storefront_store_store}" | ||
157 | elif [[ ${cfg_storefront_store_enabled} = 0 ]] | ||
158 | then | ||
159 | control_client "${serial}" set storefront.store del "${cfg_storefront_store_store}" | ||
160 | # remove from database too | ||
161 | mysqldo "delete from cfg_storefront_store where id='${id}';" | ||
162 | else | ||
163 | eecho "unknown enabled value id->'${id}', cfg_storefront_store_enabled -> '${cfg_storefront_store_enabled}'" | ||
164 | return 1 | ||
165 | fi | ||
166 | done | ||
167 | } |