Annotation of /mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-session.in
Parent Directory | Revision Log
Revision 2593 -
(hide annotations)
(download)
Fri Sep 18 12:24:18 2015 UTC (8 years, 8 months ago) by niro
File size: 2901 byte(s)
Fri Sep 18 12:24:18 2015 UTC (8 years, 8 months ago) by niro
File size: 2901 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 | 2354 | #!/bin/bash |
2 | |||
3 | MCORE_LIBDIR="@@MCORE_LIBDIR@@" | ||
4 | source @@SYSCONFDIR@@/mcore/mcore.conf | ||
5 | source ${MCORE_LIBDIR}/include/common.global.class | ||
6 | source ${MCORE_LIBDIR}/include/daemon.global.class | ||
7 | |||
8 | niro | 2357 | STOREFRONTDIR="${MCORE_CONFIG_PATH}/citrix/storefront" |
9 | niro | 2354 | |
10 | die() { echo "ERROR: $@"; exit 1; } | ||
11 | |||
12 | niro | 2393 | print_storefront_session_list() |
13 | { | ||
14 | local counter | ||
15 | |||
16 | declare -i counter=0 | ||
17 | x11runas "${MCORE_LIBDIR}/storefront-resolver --enumerate --user '${user}' --password '${password}' --domain '${domain}'" | while read line | ||
18 | do | ||
19 | niro | 2395 | [[ ${counter} -gt 0 ]] && echo "${line}" | cut -d"'" -f1-3 |
20 | niro | 2393 | ((counter++)) |
21 | done | ||
22 | } | ||
23 | |||
24 | niro | 2354 | # very basic getops |
25 | for argv in $* | ||
26 | do | ||
27 | case $1 in | ||
28 | --add|--del|--print|--query) method="${1//--}" ;; | ||
29 | --name) shift; name="$1" ;; | ||
30 | --session) shift; session="$1" ;; | ||
31 | --user) shift; user="$1" ;; | ||
32 | --domain) shift; domain="$1" ;; | ||
33 | --password) shift; password="$1" ;; | ||
34 | niro | 2593 | --store-uri) shift; store_uri="$1" ;; |
35 | niro | 2354 | esac |
36 | shift | ||
37 | done | ||
38 | |||
39 | niro | 2383 | [[ -n ${method} ]] || die "No method given" |
40 | niro | 2354 | |
41 | case "${method}" in | ||
42 | add) | ||
43 | # requires name | ||
44 | [[ -n ${name} ]] || die "No name given" | ||
45 | # and session | ||
46 | [[ -n ${session} ]] || die "No session given" | ||
47 | |||
48 | niro | 2593 | # add store and regen user xml |
49 | if [[ -n ${store_uri} ]] | ||
50 | then | ||
51 | ${MCORE_LIBDIR}/storefront-store --add --store "${store_uri}" | ||
52 | ${MCORE_LIBDIR}/storefront-store --regen | ||
53 | fi | ||
54 | |||
55 | niro | 2354 | storefront_starter="${STOREFRONTDIR}/${name}.sh" |
56 | CONFIG="${MROOT}/${storefront_starter}" | ||
57 | clearconfig | ||
58 | |||
59 | addconfig '#!/bin/bash' | ||
60 | niro | 2593 | addconfig "${MCORE_LIBDIR}/storefront-resolver --launch --user '${user}' --password '${password}' --domain '${domain}' --app '${session}' --store '${store_uri}'" |
61 | niro | 2381 | chmod +x "${storefront_starter}" |
62 | niro | 2354 | |
63 | if is_provided fluxbox | ||
64 | then | ||
65 | # generate fluxbox menu entry | ||
66 | niro | 2381 | ${MCORE_LIBDIR}/fluxbox-menuitem --add --name "${name}" --exec "${storefront_starter}" && |
67 | niro | 2354 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu |
68 | fi | ||
69 | niro | 2381 | if is_provided idesk |
70 | then | ||
71 | # generate idesk desktop icon | ||
72 | niro | 2388 | ${MCORE_LIBDIR}/idesk-generate-icon-info --add --name "${name}" --command "${storefront_starter}" --icon default.png && |
73 | niro | 2381 | ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons |
74 | fi | ||
75 | niro | 2354 | ;; |
76 | |||
77 | del) | ||
78 | [[ -n ${name} ]] || die "No name given" | ||
79 | if [ -f ${MROOT}/${STOREFRONTDIR}/"${name}".sh ] | ||
80 | then | ||
81 | rm ${MROOT}/${STOREFRONTDIR}/"${name}".sh | ||
82 | if is_provided fluxbox | ||
83 | then | ||
84 | ${MCORE_LIBDIR}/fluxbox-menuitem --del --name "${name}" && | ||
85 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu | ||
86 | fi | ||
87 | niro | 2381 | if is_provided idesk |
88 | then | ||
89 | ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}" && | ||
90 | ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons | ||
91 | fi | ||
92 | niro | 2354 | else |
93 | eecho "No configured session named '${name}' exists." | ||
94 | fi | ||
95 | ;; | ||
96 | |||
97 | print) | ||
98 | niro | 2394 | list_files_in_directory ${MROOT}/${STOREFRONTDIR} | sed 's:\.sh::g' |
99 | niro | 2354 | ;; |
100 | |||
101 | query) | ||
102 | niro | 2393 | eval sessionlist=( $(print_storefront_session_list) ) |
103 | niro | 2354 | sessioncount="${#sessionlist[*]}" |
104 | for (( i=0; i<sessioncount; i++)) | ||
105 | do | ||
106 | rvecho -n "${sessionlist[${i}]};" | ||
107 | done | ||
108 | rvecho | ||
109 | ;; | ||
110 | esac |