Magellan Linux

Contents of /alx-src/branches/alxconf-060/bin/storefront-resolver.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6779 - (show annotations) (download) (as text)
Tue Jul 21 14:45:41 2015 UTC (8 years, 9 months ago) by niro
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 #!/bin/bash
2
3 CMD="$1"
4 USER="$2"
5 PASS="$3"
6 DOMAIN="$4"
7 APP="$5"
8
9 BROWSER=""
10 : ${STORE=""}
11
12 if [[ -z ${STORE} ]]
13 then
14 source /etc/alxconfig-ng/storefront.rc
15 fi
16
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 USE_XMESSAGE=0
32 if [[ -x $(type -P xmessage) ]]
33 then
34 USE_XMESSAGE=1
35 fi
36
37 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 case ${CMD} in
48 enumerate)
49 # enumerate apps
50 storefront_enumerate
51 ;;
52
53 launch)
54 # launch apps
55 if [[ ${USE_XMESSAGE} = 1 ]]
56 then
57 xmessage -center -title "ICA-Client" -buttons "" "
58 Starting session '${APP}' ...
59
60 " &
61 fi
62 # 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 then
67 storefront_enumerate
68 fi
69 if storefront_launch
70 then
71 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 ;;
88
89 *)
90 echo "Unknown command '${CMD}'."
91 exit 1
92 ;;
93 esac