Annotation of /mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-session.in
Parent Directory | Revision Log
Revision 2391 -
(hide annotations)
(download)
Thu Aug 27 07:38:22 2015 UTC (8 years, 9 months ago) by niro
File size: 2427 byte(s)
Thu Aug 27 07:38:22 2015 UTC (8 years, 9 months ago) by niro
File size: 2427 byte(s)
--added basic getopts to clarify and ease things, fixed broken config include and resulting missing variables and renamed STOREFRONT_STORE to DEFAULT_STOREFRONT_STORE in citrix.conf
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 | # very basic getops | ||
13 | for argv in $* | ||
14 | do | ||
15 | case $1 in | ||
16 | --add|--del|--print|--query) method="${1//--}" ;; | ||
17 | --name) shift; name="$1" ;; | ||
18 | --session) shift; session="$1" ;; | ||
19 | --user) shift; user="$1" ;; | ||
20 | --domain) shift; domain="$1" ;; | ||
21 | --password) shift; password="$1" ;; | ||
22 | esac | ||
23 | shift | ||
24 | done | ||
25 | |||
26 | niro | 2383 | [[ -n ${method} ]] || die "No method given" |
27 | niro | 2354 | |
28 | case "${method}" in | ||
29 | add) | ||
30 | # requires name | ||
31 | [[ -n ${name} ]] || die "No name given" | ||
32 | # and session | ||
33 | [[ -n ${session} ]] || die "No session given" | ||
34 | |||
35 | storefront_starter="${STOREFRONTDIR}/${name}.sh" | ||
36 | CONFIG="${MROOT}/${storefront_starter}" | ||
37 | clearconfig | ||
38 | |||
39 | addconfig '#!/bin/bash' | ||
40 | niro | 2391 | addconfig "${MCORE_LIBDIR}/storefront-resolver --launch --user '${user}' --password '${password}' --domain '${domain}' --app '${session}'" |
41 | niro | 2381 | chmod +x "${storefront_starter}" |
42 | niro | 2354 | |
43 | if is_provided fluxbox | ||
44 | then | ||
45 | # generate fluxbox menu entry | ||
46 | niro | 2381 | ${MCORE_LIBDIR}/fluxbox-menuitem --add --name "${name}" --exec "${storefront_starter}" && |
47 | niro | 2354 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu |
48 | fi | ||
49 | niro | 2381 | if is_provided idesk |
50 | then | ||
51 | # generate idesk desktop icon | ||
52 | niro | 2388 | ${MCORE_LIBDIR}/idesk-generate-icon-info --add --name "${name}" --command "${storefront_starter}" --icon default.png && |
53 | niro | 2381 | ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons |
54 | fi | ||
55 | niro | 2354 | ;; |
56 | |||
57 | del) | ||
58 | [[ -n ${name} ]] || die "No name given" | ||
59 | if [ -f ${MROOT}/${STOREFRONTDIR}/"${name}".sh ] | ||
60 | then | ||
61 | rm ${MROOT}/${STOREFRONTDIR}/"${name}".sh | ||
62 | if is_provided fluxbox | ||
63 | then | ||
64 | ${MCORE_LIBDIR}/fluxbox-menuitem --del --name "${name}" && | ||
65 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu | ||
66 | fi | ||
67 | niro | 2381 | if is_provided idesk |
68 | then | ||
69 | ${MCORE_LIBDIR}/idesk-generate-icon-info --del --name "${name}" && | ||
70 | ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons | ||
71 | fi | ||
72 | niro | 2354 | else |
73 | eecho "No configured session named '${name}' exists." | ||
74 | fi | ||
75 | ;; | ||
76 | |||
77 | print) | ||
78 | list_files_in_directory ${MROOT}/${STOREFRONTDIR} | ||
79 | ;; | ||
80 | |||
81 | query) | ||
82 | niro | 2391 | eval sessionlist=( $(x11runas "${MCORE_LIBDIR}/storefront-resolver --enumerate --user '${user}' --password '${password}' --domain '${domain}'") ) |
83 | niro | 2354 | sessioncount="${#sessionlist[*]}" |
84 | for (( i=0; i<sessioncount; i++)) | ||
85 | do | ||
86 | rvecho -n "${sessionlist[${i}]};" | ||
87 | done | ||
88 | rvecho | ||
89 | ;; | ||
90 | esac |