Magellan Linux

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

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

revision 2381 by niro, Wed Aug 26 11:53:18 2015 UTC revision 2642 by niro, Thu Oct 8 10:23:56 2015 UTC
# Line 9  STOREFRONTDIR="${MCORE_CONFIG_PATH}/citr Line 9  STOREFRONTDIR="${MCORE_CONFIG_PATH}/citr
9    
10  die() { echo "ERROR: $@"; exit 1; }  die() { echo "ERROR: $@"; exit 1; }
11    
12    print_storefront_session_list()
13    {
14     local counter
15    
16     declare -i counter=0
17     x11runas "${MCORE_LIBDIR}/storefront-resolver --enumerate --user '${user}' --password '${password}' --domain '${domain}'" | while read line
18     do
19     [[ ${counter} -gt 0 ]] && echo "${line}" | cut -d"'" -f1-3
20     ((counter++))
21     done
22    }
23    
24  # very basic getops  # very basic getops
25  for argv in $*  for argv in $*
26  do  do
# Line 19  do Line 31  do
31   --user) shift; user="$1" ;;   --user) shift; user="$1" ;;
32   --domain) shift; domain="$1" ;;   --domain) shift; domain="$1" ;;
33   --password) shift; password="$1" ;;   --password) shift; password="$1" ;;
34     --store) shift; store="$1" ;;
35     --autostart) shift; autostart="$1" ;;
36   esac   esac
37   shift   shift
38  done  done
39    
40  [[ -n ${method} ]] || die "No method given"  [[ -n ${method} ]] || die "No method given"
41    [[ -n ${autostart} ]] || autostart=0
42    
43  case "${method}" in  case "${method}" in
44   add)   add)
# Line 32  case "${method}" in Line 47  case "${method}" in
47   # and session   # and session
48   [[ -n ${session} ]] || die "No session given"   [[ -n ${session} ]] || die "No session given"
49    
50     # add store and regen user xml
51     if [[ -n ${store} ]]
52     then
53     ${MCORE_LIBDIR}/storefront-store --add --store "${store}"
54     ${MCORE_LIBDIR}/storefront-store --regen
55     fi
56    
57   storefront_starter="${STOREFRONTDIR}/${name}.sh"   storefront_starter="${STOREFRONTDIR}/${name}.sh"
58   CONFIG="${MROOT}/${storefront_starter}"   CONFIG="${MROOT}/${storefront_starter}"
59   clearconfig   clearconfig
60    
61   addconfig '#!/bin/bash'   addconfig '#!/bin/bash'
62   addconfig "${MCORE_LIBDIR}/storefront-resolver launch '${user}' '${password}' '${domain}' '${session}'"   addconfig "${MCORE_LIBDIR}/storefront-resolver --launch --user '${user}' --password '${password}' --domain '${domain}' --app '${session}' --store '${store}'"
63   chmod +x "${storefront_starter}"   chmod +x "${storefront_starter}"
64    
65   if is_provided fluxbox   if is_provided fluxbox
# Line 45  case "${method}" in Line 67  case "${method}" in
67   # generate fluxbox menu entry   # generate fluxbox menu entry
68   ${MCORE_LIBDIR}/fluxbox-menuitem --add --name "${name}" --exec "${storefront_starter}" &&   ${MCORE_LIBDIR}/fluxbox-menuitem --add --name "${name}" --exec "${storefront_starter}" &&
69   ${MCORE_LIBDIR}/fluxbox-rebuild-menu   ${MCORE_LIBDIR}/fluxbox-rebuild-menu
70     # add autostart
71     if [[ ${autostart} = 1 ]]
72     then
73     ${MCORE_LIBDIR}/fluxbox-autostart --add --name "${name}" --exec "${storefront_starter}" &&
74     ${MCORE_LIBDIR}/fluxbox-rebuild-autostart
75     fi
76   fi   fi
77   if is_provided idesk   if is_provided idesk
78   then   then
79   # generate idesk desktop icon   # generate idesk desktop icon
80   ${MCORE_LIBDIR}/idesk-generate-icon-info -add --name "{name}" --command "${storefront_starter}" --icon default.png &&   ${MCORE_LIBDIR}/idesk-generate-icon-info --add --name "${name}" --command "${storefront_starter}" --icon default.png &&
81   ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons   ${MCORE_LIBDIR}/idesk-generate-all-desktop-icons
82   fi   fi
83   ;;   ;;
# Line 63  case "${method}" in Line 91  case "${method}" in
91   then   then
92   ${MCORE_LIBDIR}/fluxbox-menuitem --del  --name "${name}" &&   ${MCORE_LIBDIR}/fluxbox-menuitem --del  --name "${name}" &&
93   ${MCORE_LIBDIR}/fluxbox-rebuild-menu   ${MCORE_LIBDIR}/fluxbox-rebuild-menu
94     ${MCORE_LIBDIR}/fluxbox-autostart --del  --name "${name}" &&
95     ${MCORE_LIBDIR}/fluxbox-rebuild-autostart
96   fi   fi
97   if is_provided idesk   if is_provided idesk
98   then   then
# Line 75  case "${method}" in Line 105  case "${method}" in
105   ;;   ;;
106    
107   print)   print)
108   list_files_in_directory ${MROOT}/${STOREFRONTDIR}   list_files_in_directory ${MROOT}/${STOREFRONTDIR} | sed 's:\.sh::g'
109   ;;   ;;
110    
111   query)   query)
112   eval sessionlist=( $(su - "${MCORE_UNPRIV_USER}" -c "${MCORE_LIBDIR}/storefront-resolver enumerate '${user}' '${password}' '${domain}'") )   eval sessionlist=( $(print_storefront_session_list) )
113   sessioncount="${#sessionlist[*]}"   sessioncount="${#sessionlist[*]}"
114   for (( i=0; i<sessioncount; i++))   for (( i=0; i<sessioncount; i++))
115   do   do

Legend:
Removed from v.2381  
changed lines
  Added in v.2642