Annotation of /mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-session.in
Parent Directory | Revision Log
Revision 2357 -
(hide annotations)
(download)
Mon Aug 24 14:11:55 2015 UTC (8 years, 9 months ago) by niro
File size: 1948 byte(s)
Mon Aug 24 14:11:55 2015 UTC (8 years, 9 months ago) by niro
File size: 1948 byte(s)
-serveral fixups to get things work
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 | [[ -n ${method} ]] || die "No method given" | ||
27 | |||
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 | 2357 | addconfig "${MCORE_LIBDIR}/storefront-resolver launch '${user}' '${password}' '${domain}' '${session}'" |
41 | niro | 2354 | |
42 | if is_provided fluxbox | ||
43 | then | ||
44 | # generate fluxbox menu entry | ||
45 | niro | 2357 | ${MCORE_LIBDIR}/fluxbox-menuitem --add --name "${name}" --exec "bash ${storefront_starter}" && |
46 | niro | 2354 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu |
47 | fi | ||
48 | ;; | ||
49 | |||
50 | del) | ||
51 | [[ -n ${name} ]] || die "No name given" | ||
52 | if [ -f ${MROOT}/${STOREFRONTDIR}/"${name}".sh ] | ||
53 | then | ||
54 | rm ${MROOT}/${STOREFRONTDIR}/"${name}".sh | ||
55 | if is_provided fluxbox | ||
56 | then | ||
57 | ${MCORE_LIBDIR}/fluxbox-menuitem --del --name "${name}" && | ||
58 | ${MCORE_LIBDIR}/fluxbox-rebuild-menu | ||
59 | fi | ||
60 | else | ||
61 | eecho "No configured session named '${name}' exists." | ||
62 | fi | ||
63 | ;; | ||
64 | |||
65 | print) | ||
66 | list_files_in_directory ${MROOT}/${STOREFRONTDIR} | ||
67 | ;; | ||
68 | |||
69 | query) | ||
70 | niro | 2357 | eval sessionlist=( $(su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver enumerate '${user}' '${password}' '${domain}'") ) |
71 | niro | 2354 | sessioncount="${#sessionlist[*]}" |
72 | for (( i=0; i<sessioncount; i++)) | ||
73 | do | ||
74 | rvecho -n "${sessionlist[${i}]};" | ||
75 | done | ||
76 | rvecho | ||
77 | ;; | ||
78 | esac |