Contents of /mcore-src/trunk/mcore-tools/src/modules/citrix/storefront.client.class.in
Parent Directory | Revision Log
Revision 2384 -
(show annotations)
(download)
Wed Aug 26 12:04:22 2015 UTC (9 years, 1 month ago) by niro
File size: 3911 byte(s)
Wed Aug 26 12:04:22 2015 UTC (9 years, 1 month ago) by niro
File size: 3911 byte(s)
-fixed broken help
1 | # $Id$ |
2 | |
3 | provide citrix storefront |
4 | |
5 | # needs fluxbox! |
6 | require fluxbox basic-video |
7 | |
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 | mecho "get storefront.session [action] [user] [domain] [password]" |
30 | 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 | local user="${CLASS_ARGV[3]}" |
53 | local domain="${CLASS_ARGV[4]}" |
54 | local password="${CLASS_ARGV[5]}" |
55 | local i |
56 | |
57 | [[ -z ${action} ]] && help_citrix_session && return 1 |
58 | |
59 | case "${action}" in |
60 | add) |
61 | # requires name |
62 | [[ -z ${name} ]] && help_storefront_session && return 1 |
63 | # and session |
64 | [[ -z ${session} ]] && help_storefront_session && return 1 |
65 | |
66 | # create storefront session starter |
67 | ${MCORE_LIBDIR}/storefront-session \ |
68 | --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 | ${MCORE_LIBDIR}/storefront-session --del --name "${name}" |
80 | else |
81 | for i in $(NOCOLORS=true ${MCORE_LIBDIR}/storefront-session --print) |
82 | do |
83 | # basename |
84 | name="${i%.*}" |
85 | ${MCORE_LIBDIR}/storefront-session --del --name "${name}" |
86 | done |
87 | fi |
88 | ;; |
89 | |
90 | *) help_storefront_session && return 1 ;; |
91 | esac |
92 | } |
93 | |
94 | get_storefront_session() |
95 | { |
96 | local action="${CLASS_ARGV[0]}" |
97 | local user="${CLASS_ARGV[1]}" |
98 | local domain="${CLASS_ARGV[2]}" |
99 | local password="${CLASS_ARGV[3]}" |
100 | |
101 | [[ -z ${action} ]] && help_storefront_session && return 1 |
102 | |
103 | case "${action}" in |
104 | print) ${MCORE_LIBDIR}/storefront-session --print ;; |
105 | 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 | *) help_citrix_session && return 1 ;; |
114 | 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 | add) su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver addstore '${store}'" ;; |
127 | del) |
128 | if [[ -n ${store} ]] |
129 | then |
130 | su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver delstore '${store}'" |
131 | else |
132 | # delete all items |
133 | for i in $(su - "${MCORE_UNPRIV_USER}" -c NOCOLORS=true ${MCORE_LIBDIR}/storefront-resolver liststore) |
134 | do |
135 | su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver delstore '${i}'" |
136 | done |
137 | fi |
138 | ;; |
139 | *) help_storefront_store && return 1 ;; |
140 | esac |
141 | } |
142 | |
143 | get_storefront_store() |
144 | { |
145 | su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver liststore" |
146 | } |