Magellan Linux

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

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

revision 2600 by niro, Fri Sep 18 12:46:00 2015 UTC revision 2605 by niro, Fri Sep 18 13:16:06 2015 UTC
# Line 24  normalize_store() Line 24  normalize_store()
24  generate_storefront_xml()  generate_storefront_xml()
25  {  {
26   local config   local config
27   local store_uri   local store
28   local xml   local xml
29    
30   install -o "${MCORE_UNPRIV_USER}" -g "${MCORE_UNPRIV_GROUP}" -d "${MCORE_UNPRIV_HOME}/.ICAClient/cache/Stores"   install -d "${MCORE_UNPRIV_HOME}/.ICAClient/cache/Stores"
31     chown -R "${MCORE_UNPRIV_USER}":"${MCORE_UNPRIV_GROUP}" "${MCORE_UNPRIV_HOME}/.ICAClient"
32    
33   CONFIG="${MCORE_UNPRIV_HOME}/.ICAClient/cache/Stores/StoreCache.ctx"   CONFIG="${MCORE_UNPRIV_HOME}/.ICAClient/cache/Stores/StoreCache.ctx"
34   clearconfig   clearconfig
35   addconfig '<StoreCache>'   addconfig '<StoreCache>'
36   if [[ -L ${STOREFRONT_DIR}/default-store ]]   if [[ -L ${STOREFRONT_DIR}/default-store ]]
37   then   then
38   store_uri=$(source ${STOREFRONT_DIR}/default-store; echo "${STORE}")   store=$(source ${STOREFRONT_DIR}/default-store; echo "${STORE}")
39   addconfig "   <DefaultStore>${store_uri}</DefaultStore>"   addconfig "   <DefaultStore>${store}</DefaultStore>"
40   else   else
41   # use the first one which gets found   # use the first one which gets found
42   for config in $(NOCOLOR=1 list_files_in_directory ${STOREFRONT_STORES_DIR})   for config in $(NOCOLORS=1 list_files_in_directory ${STOREFRONT_STORES_DIR})
43   do   do
44   store_uri=$(source ${STOREFRONT_STORES_DIR}/${config}; echo "${STORE}")   store=$(source ${STOREFRONT_STORES_DIR}/${config}; echo "${STORE}")
45   if [[ -n ${store_uri} ]]   if [[ -n ${store} ]]
46   then   then
47   addconfig "   <DefaultStore>${store_uri}</DefaultStore>"   addconfig "   <DefaultStore>${store}</DefaultStore>"
48   break   break
49   fi   fi
50   done   done
# Line 54  generate_storefront_xml() Line 56  generate_storefront_xml()
56   addconfig '   <SelfSelection>True</SelfSelection>'   addconfig '   <SelfSelection>True</SelfSelection>'
57   addconfig '   <SessionWindowedMode>False</SessionWindowedMode>'   addconfig '   <SessionWindowedMode>False</SessionWindowedMode>'
58   addconfig '   <VisibleStores>'   addconfig '   <VisibleStores>'
59   for config in $(NOCOLOR=1 list_files_in_directory ${STOREFRONT_STORES_DIR})   for config in $(NOCOLORS=1 list_files_in_directory ${STOREFRONT_STORES_DIR})
60   do   do
61   store_uri=$(source ${STOREFRONT_STORES_DIR}/${config}; echo "${STORE}")   store=$(source ${STOREFRONT_STORES_DIR}/${config}; echo "${STORE}")
62   if [[ -n ${store_uri} ]]   if [[ -n ${store} ]]
63   then   then
64   addconfig "      <Store name=\"${store_uri}\" type=\"PNA\">"   addconfig "      <Store name=\"${store}\" type=\"PNA\">"
65   addconfig "         ${store_uri}"   addconfig "         ${store}"
66   addconfig '      </Store>'   addconfig '      </Store>'
67   fi   fi
68   done   done
# Line 75  for argv in $* Line 77  for argv in $*
77  do  do
78   case $1 in   case $1 in
79   --add|--del|--default|--print|--regen) method="${1//--}" ;;   --add|--del|--default|--print|--regen) method="${1//--}" ;;
80   --store) shift; store_uri="$1" ;;   --store) shift; store="$1" ;;
81   esac   esac
82   shift   shift
83  done  done
# Line 88  install -d "${STOREFRONT_STORES_DIR}" Line 90  install -d "${STOREFRONT_STORES_DIR}"
90  case "${method}" in  case "${method}" in
91   add)   add)
92   # requires name and store   # requires name and store
93   [[ -n ${store_uri} ]] || die "No store uri given"   [[ -n ${store} ]] || die "No store uri given"
94    
95   # only pna stores are allowed at the moment   # only pna stores are allowed at the moment
96   if [[ ${store_uri/config.xml} = ${store_uri} ]]   if [[ ${store/config.xml} = ${store} ]]
97   then   then
98   die "Only PNA Stores are allowed."   die "Only PNA Stores are allowed."
99   fi   fi
100    
101   store_name="$(normalize_store ${store_uri})"   store_name="$(normalize_store ${store})"
102   config="${STOREFRONT_STORES_DIR}/${store_name}.conf"   config="${STOREFRONT_STORES_DIR}/${store_name}.conf"
103   CONFIG="${MROOT}/${config}"   CONFIG="${MROOT}/${config}"
104   clearconfig   clearconfig
105   addconfig "STORE=\"${store_uri}\""   addconfig "STORE=\"${store}\""
106   ;;   ;;
107    
108   del)   del)
109   if [[ -z ${store_uri} ]]   if [[ -z ${store} ]]
110   then   then
111   for config in $(NOCOLOR=1 list_files_in_directory ${STOREFRONT_STORES_DIR})   for config in $(NOCOLORS=1 list_files_in_directory ${STOREFRONT_STORES_DIR})
112   do   do
113   if [ -f ${config} ] && [[ ${config/.conf} != ${config} ]]   if [ -f ${config} ] && [[ ${config/.conf} != ${config} ]]
114   then   then
# Line 114  case "${method}" in Line 116  case "${method}" in
116   fi   fi
117   done   done
118   else   else
119   store_name="$(normalize_store ${store_uri})"   store_name="$(normalize_store ${store})"
120   if [ -f ${MROOT}/${STOREFRONT_STORES_DIR}/"${store_name}".conf ]   if [ -f ${MROOT}/${STOREFRONT_STORES_DIR}/"${store_name}".conf ]
121   then   then
122   rm ${MROOT}/${STOREFRONT_STORES_DIR}/"${store_name}".conf   rm ${MROOT}/${STOREFRONT_STORES_DIR}/"${store_name}".conf
# Line 125  case "${method}" in Line 127  case "${method}" in
127   ;;   ;;
128    
129   default)   default)
130   # requires store_uri   # requires store
131   [[ -n ${store_uri} ]] || die "No store uri given"   [[ -n ${store} ]] || die "No store uri given"
132    
133   store_name="$(normalize_store ${store_uri})"   store_name="$(normalize_store ${store})"
134   if [ -f ${MROOT}/${STOREFRONT_STORES_DIR}/"${store_name}".conf ]   if [ -f ${MROOT}/${STOREFRONT_STORES_DIR}/"${store_name}".conf ]
135   then   then
136   ln -snf ${STOREFRONT_STORES_DIR}/"${store_name}".conf ${STOREFRONT_DIR}/default-store   ln -snf ${STOREFRONT_STORES_DIR}/"${store_name}".conf ${STOREFRONT_DIR}/default-store
# Line 138  case "${method}" in Line 140  case "${method}" in
140   ;;   ;;
141    
142   print)   print)
143   for config in $(NOCOLOR=1 list_files_in_directory ${STOREFRONT_STORES_DIR})   for config in $(NOCOLORS=1 list_files_in_directory ${STOREFRONT_STORES_DIR})
144   do   do
145   if [ -f ${STOREFRONT_STORES_DIR}/${config} ]   if [ -f ${STOREFRONT_STORES_DIR}/${config} ]
146   then   then
147   store_uri=$(source ${STOREFRONT_STORES_DIR}/${config}; echo "${STORE}")   store=$(source ${STOREFRONT_STORES_DIR}/${config}; echo "${STORE}")
148   rvecho "${store_uri}"   rvecho "${store}"
149   fi   fi
150   done   done
151   ;;   ;;

Legend:
Removed from v.2600  
changed lines
  Added in v.2605