Annotation of /mcore-src/trunk/mcore-tools/src/modules/citrix/storefront.client.class.in
Parent Directory | Revision Log
Revision 2386 -
(hide annotations)
(download)
Wed Aug 26 12:18:06 2015 UTC (9 years, 1 month ago) by niro
File size: 3923 byte(s)
Wed Aug 26 12:18:06 2015 UTC (9 years, 1 month ago) by niro
File size: 3923 byte(s)
-require idesk
1 | niro | 2354 | # $Id$ |
2 | |||
3 | provide citrix storefront | ||
4 | |||
5 | niro | 2386 | # needs fluxbox and idesk! |
6 | require fluxbox idesk | ||
7 | niro | 2354 | |
8 | # citrix global config | ||
9 | include @@SYSCONFDIR@@/mcore/citrix.conf | ||
10 | |||
11 | help_storefront_store() | ||
12 | { | ||
13 | mecho "get storefront.store" | ||
14 | mecho " Shows all stores added on the storelist." | ||
15 | mecho | ||
16 | mecho "set storefront.store [action] [store]" | ||
17 | mecho " Adds or deletes a store from the storefront storelist." | ||
18 | mecho " [actions]:" | ||
19 | mecho " add - adds a store" | ||
20 | mecho " del - deletes a store" | ||
21 | mecho | ||
22 | mecho " store - FQDN to the store" | ||
23 | mecho | ||
24 | mecho " If no [store] was given, all entries are deleted." | ||
25 | } | ||
26 | |||
27 | help_storefront_session() | ||
28 | { | ||
29 | niro | 2357 | mecho "get storefront.session [action] [user] [domain] [password]" |
30 | niro | 2354 | mecho " Shows all configured storefront sessions" |
31 | mecho " print - prints all local configured sessions" | ||
32 | mecho " query - get sessionlist of the farm from given [server]" | ||
33 | mecho | ||
34 | mecho "set storefront.session [action] [name] [session] [user] [domain] [password]" | ||
35 | mecho " Adds or delets a storefront session." | ||
36 | mecho " Available actions:" | ||
37 | mecho " add - adds a new storefront session" | ||
38 | mecho " del - deletes storefront session with name [name]" | ||
39 | mecho " if no [name] given, all sessions will be deleted" | ||
40 | mecho | ||
41 | mecho " session - name of the Citrix session" | ||
42 | mecho " user - user inside the session - optional" | ||
43 | mecho " domain - logon domain of the user - optional" | ||
44 | mecho " password - password of the user - optional" | ||
45 | } | ||
46 | |||
47 | set_storefront_session() | ||
48 | { | ||
49 | local action="${CLASS_ARGV[0]}" | ||
50 | local name="${CLASS_ARGV[1]}" | ||
51 | local session="${CLASS_ARGV[2]}" | ||
52 | niro | 2357 | local user="${CLASS_ARGV[3]}" |
53 | local domain="${CLASS_ARGV[4]}" | ||
54 | local password="${CLASS_ARGV[5]}" | ||
55 | niro | 2354 | local i |
56 | |||
57 | niro | 2385 | [[ -z ${action} ]] && help_storefront_session && return 1 |
58 | niro | 2354 | |
59 | case "${action}" in | ||
60 | add) | ||
61 | # requires name | ||
62 | niro | 2355 | [[ -z ${name} ]] && help_storefront_session && return 1 |
63 | niro | 2354 | # and session |
64 | niro | 2355 | [[ -z ${session} ]] && help_storefront_session && return 1 |
65 | niro | 2354 | |
66 | niro | 2355 | # create storefront session starter |
67 | ${MCORE_LIBDIR}/storefront-session \ | ||
68 | niro | 2354 | --add \ |
69 | --name "${name}" \ | ||
70 | --session "${session}" \ | ||
71 | --user "${user}" \ | ||
72 | --domain "${domain}" \ | ||
73 | --password "${password}" | ||
74 | ;; | ||
75 | |||
76 | del) | ||
77 | if [[ -n ${name} ]] | ||
78 | then | ||
79 | niro | 2355 | ${MCORE_LIBDIR}/storefront-session --del --name "${name}" |
80 | niro | 2354 | else |
81 | niro | 2355 | for i in $(NOCOLORS=true ${MCORE_LIBDIR}/storefront-session --print) |
82 | niro | 2354 | do |
83 | # basename | ||
84 | name="${i%.*}" | ||
85 | niro | 2355 | ${MCORE_LIBDIR}/storefront-session --del --name "${name}" |
86 | niro | 2354 | done |
87 | fi | ||
88 | ;; | ||
89 | |||
90 | niro | 2355 | *) help_storefront_session && return 1 ;; |
91 | niro | 2354 | esac |
92 | } | ||
93 | |||
94 | get_storefront_session() | ||
95 | { | ||
96 | local action="${CLASS_ARGV[0]}" | ||
97 | niro | 2357 | local user="${CLASS_ARGV[1]}" |
98 | local domain="${CLASS_ARGV[2]}" | ||
99 | local password="${CLASS_ARGV[3]}" | ||
100 | niro | 2354 | |
101 | niro | 2355 | [[ -z ${action} ]] && help_storefront_session && return 1 |
102 | niro | 2354 | |
103 | case "${action}" in | ||
104 | niro | 2355 | print) ${MCORE_LIBDIR}/storefront-session --print ;; |
105 | niro | 2357 | query) |
106 | if [[ -n ${user} ]] | ||
107 | then | ||
108 | ${MCORE_LIBDIR}/storefront-session --query --user "${user}" --domain "${domain}" --password "${password}" | ||
109 | else | ||
110 | ${MCORE_LIBDIR}/storefront-session --query | ||
111 | fi | ||
112 | ;; | ||
113 | niro | 2385 | *) help_storefront_session && return 1 ;; |
114 | niro | 2354 | esac |
115 | } | ||
116 | |||
117 | set_storefront_store() | ||
118 | { | ||
119 | local action="${CLASS_ARGV[0]}" | ||
120 | local store="${CLASS_ARGV[1]}" | ||
121 | local i | ||
122 | |||
123 | [[ -z ${action} ]] && help_storefront_store && return 1 | ||
124 | |||
125 | case "${action}" in | ||
126 | niro | 2357 | add) su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver addstore '${store}'" ;; |
127 | niro | 2354 | del) |
128 | if [[ -n ${store} ]] | ||
129 | then | ||
130 | niro | 2357 | su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver delstore '${store}'" |
131 | niro | 2354 | else |
132 | # delete all items | ||
133 | niro | 2357 | for i in $(su - "${MCORE_UNPRIV_USER}" -c NOCOLORS=true ${MCORE_LIBDIR}/storefront-resolver liststore) |
134 | niro | 2354 | do |
135 | niro | 2357 | su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver delstore '${i}'" |
136 | niro | 2354 | done |
137 | fi | ||
138 | ;; | ||
139 | niro | 2384 | *) help_storefront_store && return 1 ;; |
140 | niro | 2354 | esac |
141 | } | ||
142 | |||
143 | get_storefront_store() | ||
144 | { | ||
145 | niro | 2357 | su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver liststore" |
146 | niro | 2354 | } |