Annotation of /alx-src/tags/alxconf-0_6_10/bin/storefront-resolver.sh
Parent Directory | Revision Log
Revision 6779 -
(hide annotations)
(download)
(as text)
Tue Jul 21 14:45:41 2015 UTC (9 years, 2 months ago) by niro
Original Path: alx-src/branches/alxconf-060/bin/storefront-resolver.sh
File MIME type: application/x-sh
File size: 1649 byte(s)
Tue Jul 21 14:45:41 2015 UTC (9 years, 2 months ago) by niro
Original Path: alx-src/branches/alxconf-060/bin/storefront-resolver.sh
File MIME type: application/x-sh
File size: 1649 byte(s)
auto enumerate if the cache xml was not found or is older than one day
1 | niro | 6746 | #!/bin/bash |
2 | |||
3 | CMD="$1" | ||
4 | USER="$2" | ||
5 | PASS="$3" | ||
6 | DOMAIN="$4" | ||
7 | APP="$5" | ||
8 | |||
9 | BROWSER="" | ||
10 | niro | 6764 | : ${STORE=""} |
11 | niro | 6746 | |
12 | niro | 6764 | if [[ -z ${STORE} ]] |
13 | then | ||
14 | source /etc/alxconfig-ng/storefront.rc | ||
15 | fi | ||
16 | niro | 6746 | |
17 | # prefer storebrowse | ||
18 | if [[ -e ${ICAROOT}/util/storebrowse ]] | ||
19 | then | ||
20 | BROWSER=${ICAROOT}/util/storebrowse | ||
21 | |||
22 | # use old pnabrowse | ||
23 | elif [[ -e ${ICAROOT}/util/pnabrowse ]] | ||
24 | then | ||
25 | BROWSER=${ICAROOT}/util/pnabrowse | ||
26 | else | ||
27 | echo "No Citrix browser found." | ||
28 | exit 1 | ||
29 | fi | ||
30 | |||
31 | niro | 6758 | USE_XMESSAGE=0 |
32 | if [[ -x $(type -P xmessage) ]] | ||
33 | then | ||
34 | USE_XMESSAGE=1 | ||
35 | fi | ||
36 | |||
37 | niro | 6779 | storefront_enumerate() |
38 | { | ||
39 | "${BROWSER}" -E -U "${USER}" -P "${PASS}" -D "${DOMAIN}" "${STORE}" | ||
40 | } | ||
41 | |||
42 | storefront_launch() | ||
43 | { | ||
44 | "${BROWSER}" -L "${APP}" -U "${USER}" -P "${PASS}" -D "${DOMAIN}" "${STORE}" | ||
45 | } | ||
46 | |||
47 | niro | 6746 | case ${CMD} in |
48 | enumerate) | ||
49 | # enumerate apps | ||
50 | niro | 6779 | storefront_enumerate |
51 | niro | 6746 | ;; |
52 | |||
53 | launch) | ||
54 | # launch apps | ||
55 | niro | 6758 | if [[ ${USE_XMESSAGE} = 1 ]] |
56 | then | ||
57 | xmessage -center -title "ICA-Client" -buttons "" " | ||
58 | Starting session '${APP}' ... | ||
59 | |||
60 | " & | ||
61 | fi | ||
62 | niro | 6779 | # always enumerate all apps to fill the cache or launch will not work |
63 | # and always enumerate if the cache is older than one day | ||
64 | if [ ! -f ~/.ICAClient/cache/Citrix/PNAgent/AppCache/appdata.xml ] || | ||
65 | [[ ! -z $(find ~/.ICAClient/cache/Citrix/PNAgent/AppCache/appdata.xml -mtime +1) ]] | ||
66 | niro | 6758 | then |
67 | niro | 6779 | storefront_enumerate |
68 | fi | ||
69 | if storefront_launch | ||
70 | then | ||
71 | niro | 6758 | if [[ ${USE_XMESSAGE} = 1 ]] |
72 | then | ||
73 | killall xmessage | ||
74 | fi | ||
75 | else | ||
76 | if [[ ${USE_XMESSAGE} = 1 ]] | ||
77 | then | ||
78 | killall xmessage | ||
79 | xmessage -center -title "ICA-Client" -buttons " | ||
80 | Abort" "Failed to start session '${APP}'. | ||
81 | |||
82 | " & | ||
83 | else | ||
84 | echo "Failed to start session '${APP}'." | ||
85 | fi | ||
86 | fi | ||
87 | niro | 6746 | ;; |
88 | |||
89 | *) | ||
90 | echo "Unknown command '${CMD}'." | ||
91 | exit 1 | ||
92 | ;; | ||
93 | esac |