Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-resolver.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2352 by niro, Mon Aug 24 11:03:25 2015 UTC revision 2391 by niro, Thu Aug 27 07:38:22 2015 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
 CMD="$1"  
 USER="$2"  
 PASS="$3"  
 DOMAIN="$4"  
 APP="$5"  
   
3  BROWSER=""  BROWSER=""
4  : ${STOREFRONT_STORE=""}  : ${STOREFRONT_STORE=""}
5    
6    source @@SYSCONFDIR@@/mcore/citrix.conf
7    
8  if [[ -z ${STOREFRONT_STORE} ]]  if [[ -z ${STOREFRONT_STORE} ]]
9  then  then
10   source @@SYSCONFDIR@@/mcore/citrix.conf   STOREFRONT_STORE="${DEFAULT_STOREFRONT_STORE}"
11  fi  fi
12    
13  # prefer storebrowse  # prefer storebrowse
14  if [[ -e ${STOREBROWSE_EXECUTABLE} ]]  if [[ -e ${STOREBROWSE_EXECUTABLE} ]]
15  then  then
16   BROWSER=${STOREBROWSE_EXECUTABLE}   BROWSER=${STOREBROWSE_EXECUTABLE}
17   ADDSTORE_REQUIERED=1   ADDSTORE_REQUIRED=1
18  # use old pnabrowse  # use old pnabrowse
19  elif [[ -e ${PNABROWSE_EXECUTABLE} ]]  elif [[ -e ${PNABROWSE_EXECUTABLE} ]]
20  then  then
21   BROWSER=${PNABROWSE_EXECUTABLE}   BROWSER=${PNABROWSE_EXECUTABLE}
22   ADDSTORE_REQUIERED=0   ADDSTORE_REQUIRED=0
23  else  else
24   echo "No Citrix browser found."   echo "No Citrix browser found."
25   exit 1   exit 1
# Line 35  then Line 31  then
31   USE_XMESSAGE=1   USE_XMESSAGE=1
32  fi  fi
33    
34    storefront_list_store()
35    {
36     "${BROWSER}" -l | cut -d"'" -f1-3 | sed "s:'::g"
37    }
38    
39  storefront_add_store()  storefront_add_store()
40  {  {
41   if [[ -z $("${BROWSER}" -l "${STORE}" | grep "'${STOREFRONT_STORE}'") ]]   if [[ -z $("${BROWSER}" -l "${STOREFRONT_STORE}" | grep "'${STOREFRONT_STORE}'") ]]
42   then   then
43   "${BROWSER}" -a "${STOREFRONT_STORE}"   "${BROWSER}" -a "${STOREFRONT_STORE}"
44   else   else
# Line 47  storefront_add_store() Line 48  storefront_add_store()
48    
49  storefront_delete_store()  storefront_delete_store()
50  {  {
51   if [[ -n $("${BROWSER}" -l "${STORE}" | grep "'${STOREFRONT_STORE}'") ]]   if [[ -n $("${BROWSER}" -l "${STOREFRONT_STORE}" | grep "'${STOREFRONT_STORE}'") ]]
52   then   then
53   "${BROWSER}" -d "${STOREFRONT_STORE}"   "${BROWSER}" -d "${STOREFRONT_STORE}"
54   else   else
# Line 87  storefront_launch() Line 88  storefront_launch()
88   "${BROWSER}" -L "${APP}" -U "${USER}" -P "${PASS}" -D "${DOMAIN}" "${STOREFRONT_STORE}"   "${BROWSER}" -L "${APP}" -U "${USER}" -P "${PASS}" -D "${DOMAIN}" "${STOREFRONT_STORE}"
89  }  }
90    
91    # very basic getops
92    for argv in $*
93    do
94     case $1 in
95     --enumerate|--launch|--liststore|--addstore|--delstore) CMD="${1//--}" ;;
96     --user) shift; USER="$1" ;;
97     --password) shift; PASS="$1" ;;
98     --domain) shift; DOMAIN="$1" ;;
99     --app) shift; APP="$1" ;;
100     --store) shift; STOREFRONT_STORE="$1" ;;  #override all envvars and configuration vars
101     esac
102     shift
103    done
104    
105    [[ -n ${CMD} ]] || die "No CMD given"
106    
107  case ${CMD} in  case ${CMD} in
108   enumerate)   enumerate)
109   # enumerate apps   # enumerate apps
110   if [[ ${ADDSTORE_REQUIERED} = 1 ]]   if [[ ${ADDSTORE_REQUIRED} = 1 ]]
111   then   then
112   storefront_add_store   storefront_add_store
113   fi   fi
# Line 106  case ${CMD} in Line 123  case ${CMD} in
123    
124  " &  " &
125   fi   fi
126   if [[ ${ADDSTORE_REQUIERED} = 1 ]]   if [[ ${ADDSTORE_REQUIRED} = 1 ]]
127   then   then
128   storefront_add_store   storefront_add_store
129   storefront_subscribe_app   storefront_subscribe_app
# Line 139  case ${CMD} in Line 156  case ${CMD} in
156   fi   fi
157   ;;   ;;
158    
159     liststore)
160     storefront_list_store
161     ;;
162    
163     addstore)
164     if [[ -n $2 ]]
165     then
166     STOREFRONT_STORE="$2"
167     fi
168     storefront_add_store
169     ;;
170    
171     delstore)
172     if [[ -n $2 ]]
173     then
174     STOREFRONT_STORE="$2"
175     fi
176     storefront_delete_store
177     ;;
178    
179   *)   *)
180   echo "Unknown command '${CMD}'."   echo "Unknown command '${CMD}'."
181   exit 1   exit 1

Legend:
Removed from v.2352  
changed lines
  Added in v.2391