7 |
echo "${var//\ /_}" |
echo "${var//\ /_}" |
8 |
} |
} |
9 |
|
|
10 |
|
sanitize_store() |
11 |
|
{ |
12 |
|
local var="$@" |
13 |
|
echo "$(fix_whitespaces ${var})" | sed -e 's:\::_:g' -e 's:\/:_:g' | tr '[A-Z]' '[a-z]' |
14 |
|
} |
15 |
|
|
16 |
# helper function to create citrix session files |
# helper function to create citrix session files |
17 |
generate_ica_session_file() |
generate_ica_session_file() |
18 |
{ |
{ |
101 |
local ses_domain |
local ses_domain |
102 |
local ses_password |
local ses_password |
103 |
local ses_browseradrs |
local ses_browseradrs |
104 |
|
local method |
105 |
|
local ses_method |
106 |
|
local name |
107 |
|
|
108 |
# very basic getops |
# very basic getops |
109 |
for i in $* |
for i in $* |
115 |
--password) shift; ses_password="$1" ;; |
--password) shift; ses_password="$1" ;; |
116 |
--domain) shift; ses_domain="$1" ;; |
--domain) shift; ses_domain="$1" ;; |
117 |
--server) shift; ses_browseradrs="$1" ;; |
--server) shift; ses_browseradrs="$1" ;; |
118 |
|
--method) shift; method="$1" ;; |
119 |
esac |
esac |
120 |
shift |
shift |
121 |
done |
done |
122 |
|
|
123 |
|
# abort if name, dest or exec not given |
124 |
|
[[ -z ${ses_filename} ]] && return 1 |
125 |
|
[[ -z ${ses_username} ]] && return 1 |
126 |
|
[[ -z ${ses_password} ]] && return 1 |
127 |
|
[[ -z ${ses_domain} ]] && return 1 |
128 |
|
[[ -z ${ses_browseradrs} ]] && return 1 |
129 |
|
|
130 |
|
case "${method}" in |
131 |
|
enumerate) |
132 |
|
ses_method="${method}" |
133 |
|
name="store-enumerate" |
134 |
|
;; |
135 |
|
launch) |
136 |
|
ses_method="${method}" |
137 |
|
name="${ses_session}" |
138 |
|
[[ -z ${ses_session} ]] && return 1 |
139 |
|
;; |
140 |
|
*) echo "generate_storefront_sh(): wrong method given, either 'launch' or 'enumerate' are allowed." |
141 |
|
return 1 |
142 |
|
;; |
143 |
|
esac |
144 |
|
|
145 |
generate_program_sh \ |
generate_program_sh \ |
146 |
--name "${ses_session}" \ |
--name "${name}" \ |
147 |
--exec "storefront-resolver" \ |
--exec "storefront-resolver" \ |
148 |
--param "launch '${ses_username}' '${ses_password}' '${ses_domain}' '${ses_session}'" \ |
--param "${method} '${ses_username}' '${ses_password}' '${ses_domain}' '${ses_session}'" \ |
149 |
--dest "${ALX_UNPRIV_HOME}/.alxprogs/$(fix_whitespaces ${ses_filename})" \ |
--dest "${ALX_UNPRIV_HOME}/.alxprogs/$(fix_whitespaces ${ses_filename})" \ |
150 |
--environment "STORE=${ses_browseradrs}" |
--environment "STORE=${ses_browseradrs}" |
151 |
} |
} |
504 |
local fbinit |
local fbinit |
505 |
local fbkeys |
local fbkeys |
506 |
local progsh_path |
local progsh_path |
507 |
|
local storefront_enumerate=0 |
508 |
|
local storefront_store |
509 |
|
local _store |
510 |
|
local all_storefront_stores="" |
511 |
|
|
512 |
progsh_path="${ALX_UNPRIV_HOME}/.alxprogs" |
progsh_path="${ALX_UNPRIV_HOME}/.alxprogs" |
513 |
|
|
587 |
fi |
fi |
588 |
done |
done |
589 |
|
|
|
# add autostart session |
|
|
if [[ ! -z ${cfg_autostart_session} ]] |
|
|
then |
|
|
# sleep one second to wait until busybox is fully initialized and the screen is really centered |
|
|
addconfig "[startup] {sleep 1 && ${progsh_path}/$(fix_whitespaces ${cfg_autostart_session}) &}" |
|
|
fi |
|
|
|
|
590 |
# fluxbox hotkeys |
# fluxbox hotkeys |
591 |
if [ -f ${ALX_SKELETONS}/fluxbox/keys ] |
if [ -f ${ALX_SKELETONS}/fluxbox/keys ] |
592 |
then |
then |
620 |
# generate STOREFRONT/PNABROWSE compatible session |
# generate STOREFRONT/PNABROWSE compatible session |
621 |
case "${cfg_sessions_browseradrs}" in |
case "${cfg_sessions_browseradrs}" in |
622 |
"http://"*|"https://"* ) |
"http://"*|"https://"* ) |
623 |
|
# run storefront_enumerate on startup to get all available sessions |
624 |
|
storefront_enumerate=1 |
625 |
|
storefront_store="$(sanitize_store ${cfg_sessions_browseradrs})" |
626 |
|
store_found=0 |
627 |
|
for _store in ${all_storefront_stores} |
628 |
|
do |
629 |
|
if [[ ${storefront_store} = ${_store} ]] |
630 |
|
then |
631 |
|
store_found=1 |
632 |
|
fi |
633 |
|
done |
634 |
|
if [[ ${store_found} = 0 ]] |
635 |
|
then |
636 |
|
all_storefront_stores="${all_storefront_stores} ${storefront_store}" |
637 |
|
generate_storefront_sh \ |
638 |
|
--method "enumerate" \ |
639 |
|
--filename "store-enumerate_${storefront_store}_.sh" \ |
640 |
|
--username "${cfg_sessions_username}" \ |
641 |
|
--password "${cfg_sessions_password}" \ |
642 |
|
--domain "${cfg_sessions_domain}" \ |
643 |
|
--server "${cfg_sessions_browseradrs}" |
644 |
|
fi |
645 |
|
|
646 |
# generate STOREFRONT/PNABROWSE compatible session |
# generate STOREFRONT/PNABROWSE compatible session |
647 |
generate_storefront_sh \ |
generate_storefront_sh \ |
648 |
|
--method "launch" \ |
649 |
--session "${cfg_sessions_session}" \ |
--session "${cfg_sessions_session}" \ |
650 |
--filename "$(fix_whitespaces ${cfg_sessions_filename})" \ |
--filename "$(fix_whitespaces ${cfg_sessions_filename})" \ |
651 |
--username "${cfg_sessions_username}" \ |
--username "${cfg_sessions_username}" \ |
676 |
# fluxbox menusession |
# fluxbox menusession |
677 |
addconfig "[exec] (${cfg_sessions_session}) {${progsh_path}/$(fix_whitespaces ${cfg_sessions_filename})}" |
addconfig "[exec] (${cfg_sessions_session}) {${progsh_path}/$(fix_whitespaces ${cfg_sessions_filename})}" |
678 |
done |
done |
679 |
|
if [[ ${storefront_enumerate} = 1 ]] |
680 |
|
then |
681 |
|
for _store in ${all_storefront_stores} |
682 |
|
do |
683 |
|
CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps" |
684 |
|
addconfig "[startup] {${progsh_path}/store-enumerate_${_store}_.sh &}" |
685 |
|
done |
686 |
|
fi |
687 |
|
|
688 |
# add other menuitems |
# add other menuitems |
689 |
for i in ${all_other_ids} |
for i in ${all_other_ids} |
709 |
--dest "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \ |
--dest "${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})" \ |
710 |
"${workdir}" |
"${workdir}" |
711 |
|
|
712 |
|
CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu" |
713 |
addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}" |
addconfig "[exec] (${cfg_other_menuitems_name}) {${progsh_path}/$(fix_whitespaces ${cfg_other_menuitems_name})} ${cfg_other_menuitems_icon}" |
714 |
done |
done |
715 |
|
|
744 |
--dest "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \ |
--dest "${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})" \ |
745 |
"${workdir}" |
"${workdir}" |
746 |
|
|
747 |
|
CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu" |
748 |
addconfig "[exec] (${PLUGIN_MENUITEM_NAME}) {${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})} ${PLUGIN_MENUITEM_ICON}" |
addconfig "[exec] (${PLUGIN_MENUITEM_NAME}) {${progsh_path}/$(fix_whitespaces ${PLUGIN_MENUITEM_NAME})} ${PLUGIN_MENUITEM_ICON}" |
749 |
fi |
fi |
750 |
|
|
756 |
unset PLUGIN_MENUITEM_ICON |
unset PLUGIN_MENUITEM_ICON |
757 |
done |
done |
758 |
|
|
759 |
|
# add autostart session |
760 |
|
if [[ ! -z ${cfg_autostart_session} ]] |
761 |
|
then |
762 |
|
CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps" |
763 |
|
# sleep one second to wait until busybox is fully initialized and the screen is really centered |
764 |
|
addconfig "[startup] {sleep 1 && ${progsh_path}/$(fix_whitespaces ${cfg_autostart_session}) &}" |
765 |
|
fi |
766 |
|
|
767 |
# fluxbox menu footer |
# fluxbox menu footer |
768 |
cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/menu" |
769 |
|
cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${CONFIG} |
770 |
# add a newline (maybe there is no crlf in the footer) |
# add a newline (maybe there is no crlf in the footer) |
771 |
addconfig |
addconfig |
772 |
|
|