Magellan Linux

Annotation of /alx-src/branches/alxconf-060/plugins/egk_scm/plugin.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3523 - (hide annotations) (download) (as text)
Mon Apr 23 07:30:59 2012 UTC (12 years ago) by niro
File MIME type: application/x-sh
File size: 2768 byte(s)
-configure plugins via sql database
1 niro 3523 # this script gets called by config_sessions
2 niro 3393
3 niro 3514 PLUGIN_NAME="egk_scm"
4 niro 3393 PLUGIN_MENUITEM_NAME="SUM_EGK"
5     PLUGIN_MENUITEM_EXEC="rdesktop"
6 niro 3494 PLUGIN_MENUITEM_PARAM='-r scard:\"eHealth200 Terminal 00 00\"=\"SCM Microsystems Inc. Terminal0-Patient slot 0\",\"eHealth200 Terminal 00 01\"=\"SCM Microsystems Inc. Terminal0-Doctor slot 0\"'
7 niro 3393 PLUGIN_MENUITEM_WORKDIR=""
8     PLUGIN_MENUITEM_ICON=""
9    
10 niro 3523 PLUGIN_AUTOSTART=0
11 niro 3393 PLUGIN_PACKAGES="libusb libusb-compat pcsc-lite pcsc-plugin-ehealth200"
12 niro 3523 # uses rdesktop plugin config
13     PLUGIN_CONFIG="/etc/alxconfig-ng/plugin-rdesktop.conf"
14 niro 3393
15 niro 3523 # include alx functions
16     source /etc/alxconfig-ng/config.rc
17     source /etc/alxconfig-ng/serial
18     source ${ALX_FUNCTIONS}/common
19     source ${ALX_FUNCTIONS}/mysqlfunctions
20    
21 niro 3393 install_plugin()
22     {
23     local i
24     for i in ${PLUGIN_PACKAGES}
25     do
26     if [[ -z $(magequery -n ${i}) ]]
27     then
28     MAGE_BOOTSTRAP=true mage install ${i}
29     mage clean
30     fi
31     done
32     }
33    
34     setup_plugin()
35     {
36     return 0
37     }
38    
39     # create desktop buttons
40     create_menuitem()
41     {
42 niro 3523 if [ -f ${PLUGIN_CONFIG} ]
43 niro 3494 then
44 niro 3523 source ${PLUGIN_CONFIG}
45    
46     # use session name from rdesktop if available
47     if [[ ! -z ${PLUGIN_CONFIG_SESSION_NAME} ]]
48     then
49     PLUGIN_MENUITEM_NAME="${PLUGIN_CONFIG_SESSION_NAME}"
50     fi
51     else
52     # rdesktop not configured, disable plugin
53     PLUGIN_CONFIG_PARAM=""
54     PLUGIN_CONFIG_SERVER=""
55     PLUGIN_MENUITEM_NAME=""
56     PLUGIN_MENUITEM_EXEC=""
57     PLUGIN_MENUITEM_PARAM=""
58     PLUGIN_MENUITEM_WORKDIR=""
59     PLUGIN_MENUITEM_ICON=""
60 niro 3494 fi
61    
62 niro 3393 # don't touch these echo, define variables above
63     echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\""
64     echo "PLUGIN_MENUITEM_EXEC=\"${PLUGIN_MENUITEM_EXEC}\""
65 niro 3494 echo "PLUGIN_MENUITEM_PARAM=\"${PLUGIN_CONFIG_PARAM} ${PLUGIN_MENUITEM_PARAM} ${PLUGIN_CONFIG_SERVER}\""
66 niro 3393 echo "PLUGIN_MENUITEM_WORKDIR=\"${PLUGIN_MENUITEM_WORKDIR}\""
67     echo "PLUGIN_MENUITEM_ICON=\"${PLUGIN_MENUITEM_ICON}\""
68     }
69    
70 niro 3503 autostart_plugin()
71     {
72 niro 3523 # only run autostart if rdesktop was configured
73     if [ -f ${PLUGIN_CONFIG} ]
74     then
75     source ${PLUGIN_CONFIG}
76     evaluate_table plugin_egk_scm
77    
78     # use session name from rdesktop if available
79     if [[ ! -z ${PLUGIN_CONFIG_SESSION_NAME} ]]
80     then
81     PLUGIN_MENUITEM_NAME="${PLUGIN_CONFIG_SESSION_NAME}"
82     fi
83     fi
84     # sanitize variables
85     [[ -z ${plugin_egk_scm_autostart} ]] && plugin_egk_scm_autostart=0
86    
87     echo "PLUGIN_AUTOSTART=\"${plugin_egk_scm_autostart}\""
88 niro 3504 echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\""
89 niro 3503 }
90    
91 niro 3393 uninstall_plugin()
92     {
93     local i
94     for i in ${PLUGIN_PACKAGES}
95     do
96     if [[ -n $(magequery -n ${i}) ]]
97     then
98     MAGE_BOOTSTRAP=true mage uninstall ${i}
99     mage clean
100     fi
101     done
102    
103     mage clean
104     }
105    
106     case $1 in
107     install) install_plugin ;;
108     setup) setup_plugin ;;
109     menuitem) create_menuitem ;;
110 niro 3503 autostart) autostart_plugin ;;
111 niro 3393 uninstall) uninstall_plugin ;;
112     *) echo "PLUGIN '${PLUGIN_NAME}': unkown operation '$1'" ;;
113     esac