Annotation of /alx-src/branches/alxconf-060/plugins/rdesktop/plugin.sh
Parent Directory | Revision Log
Revision 3492 -
(hide annotations)
(download)
(as text)
Mon Apr 16 12:45:42 2012 UTC (12 years ago) by niro
File MIME type: application/x-sh
File size: 1650 byte(s)
Mon Apr 16 12:45:42 2012 UTC (12 years ago) by niro
File MIME type: application/x-sh
File size: 1650 byte(s)
-let the rdesktop plugin be configurable through /etc/alxconfig-ng/plugin-rdesktop.conf
1 | niro | 3391 | # this script gets included by config_sessions |
2 | |||
3 | PLUGIN_NAME="rdesktop" | ||
4 | PLUGIN_MENUITEM_NAME="" | ||
5 | PLUGIN_MENUITEM_EXEC="" | ||
6 | PLUGIN_MENUITEM_PARAM="" | ||
7 | PLUGIN_MENUITEM_WORKDIR="" | ||
8 | PLUGIN_MENUITEM_ICON="" | ||
9 | |||
10 | PLUGIN_PACKAGES="openssl rdesktop" | ||
11 | |||
12 | install_plugin() | ||
13 | { | ||
14 | local i | ||
15 | for i in ${PLUGIN_PACKAGES} | ||
16 | do | ||
17 | if [[ -z $(magequery -n ${i}) ]] | ||
18 | then | ||
19 | MAGE_BOOTSTRAP=true mage install ${i} | ||
20 | mage clean | ||
21 | fi | ||
22 | done | ||
23 | } | ||
24 | |||
25 | setup_plugin() | ||
26 | { | ||
27 | niro | 3492 | if [ ! -f /etc/alxconfig-ng/plugin-${PLUGIN_NAME}.conf ] |
28 | then | ||
29 | install /usr/lib/alxconfig-ng/plugins/${PLUGIN_NAME}/plugin-${PLUGIN_NAME}.conf /etc/alxconfig-ng | ||
30 | fi | ||
31 | |||
32 | niro | 3391 | return 0 |
33 | } | ||
34 | |||
35 | # create desktop buttons | ||
36 | create_menuitem() | ||
37 | { | ||
38 | niro | 3492 | if [ -f /etc/alxconfig-ng/plugin-rdesktop.conf ] |
39 | then | ||
40 | source /etc/alxconfig-ng/plugin-rdesktop.conf | ||
41 | fi | ||
42 | [[ -z ${PLUGIN_CONFIG_PARAM} ]] && PLUGIN_CONFIG_PARAM="" | ||
43 | [[ -z ${PLUGIN_CONFIG_SERVER} ]] && PLUGIN_CONFIG_SERVER="" | ||
44 | |||
45 | niro | 3391 | # don't touch these echo, define variables above |
46 | echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\"" | ||
47 | echo "PLUGIN_MENUITEM_EXEC=\"${PLUGIN_MENUITEM_EXEC}\"" | ||
48 | niro | 3492 | echo "PLUGIN_MENUITEM_PARAM=\"${PLUGIN_CONFIG_PARAM} ${PLUGIN_MENUITEM_PARAM} ${PLUGIN_CONFIG_SERVER}\"" |
49 | niro | 3391 | echo "PLUGIN_MENUITEM_WORKDIR=\"${PLUGIN_MENUITEM_WORKDIR}\"" |
50 | echo "PLUGIN_MENUITEM_ICON=\"${PLUGIN_MENUITEM_ICON}\"" | ||
51 | } | ||
52 | |||
53 | uninstall_plugin() | ||
54 | { | ||
55 | local i | ||
56 | for i in ${PLUGIN_PACKAGES} | ||
57 | do | ||
58 | if [[ -n $(magequery -n ${i}) ]] | ||
59 | then | ||
60 | MAGE_BOOTSTRAP=true mage uninstall ${i} | ||
61 | mage clean | ||
62 | fi | ||
63 | done | ||
64 | |||
65 | mage clean | ||
66 | } | ||
67 | |||
68 | case $1 in | ||
69 | install) install_plugin ;; | ||
70 | setup) setup_plugin ;; | ||
71 | menuitem) create_menuitem ;; | ||
72 | uninstall) uninstall_plugin ;; | ||
73 | *) echo "PLUGIN '${PLUGIN_NAME}': unkown operation '$1'" ;; | ||
74 | esac |