Contents of /alx-src/branches/alxconf-060/plugins/rdesktop/plugin.sh
Parent Directory | Revision Log
Revision 3503 -
(show annotations)
(download)
(as text)
Thu Apr 19 12:17:20 2012 UTC (12 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 1775 byte(s)
Thu Apr 19 12:17:20 2012 UTC (12 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 1775 byte(s)
-added autostart support for plugins
1 | # 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_AUTOSTART=0 |
11 | |
12 | PLUGIN_PACKAGES="openssl rdesktop" |
13 | |
14 | install_plugin() |
15 | { |
16 | local i |
17 | for i in ${PLUGIN_PACKAGES} |
18 | do |
19 | if [[ -z $(magequery -n ${i}) ]] |
20 | then |
21 | MAGE_BOOTSTRAP=true mage install ${i} |
22 | mage clean |
23 | fi |
24 | done |
25 | } |
26 | |
27 | setup_plugin() |
28 | { |
29 | if [ ! -f /etc/alxconfig-ng/plugin-${PLUGIN_NAME}.conf ] |
30 | then |
31 | install /usr/lib/alxconfig-ng/plugins/${PLUGIN_NAME}/plugin-${PLUGIN_NAME}.conf /etc/alxconfig-ng |
32 | fi |
33 | |
34 | return 0 |
35 | } |
36 | |
37 | # create desktop buttons |
38 | create_menuitem() |
39 | { |
40 | if [ -f /etc/alxconfig-ng/plugin-rdesktop.conf ] |
41 | then |
42 | source /etc/alxconfig-ng/plugin-rdesktop.conf |
43 | fi |
44 | [[ -z ${PLUGIN_CONFIG_PARAM} ]] && PLUGIN_CONFIG_PARAM="" |
45 | [[ -z ${PLUGIN_CONFIG_SERVER} ]] && PLUGIN_CONFIG_SERVER="" |
46 | |
47 | # don't touch these echo, define variables above |
48 | echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\"" |
49 | echo "PLUGIN_MENUITEM_EXEC=\"${PLUGIN_MENUITEM_EXEC}\"" |
50 | echo "PLUGIN_MENUITEM_PARAM=\"${PLUGIN_CONFIG_PARAM} ${PLUGIN_MENUITEM_PARAM} ${PLUGIN_CONFIG_SERVER}\"" |
51 | echo "PLUGIN_MENUITEM_WORKDIR=\"${PLUGIN_MENUITEM_WORKDIR}\"" |
52 | echo "PLUGIN_MENUITEM_ICON=\"${PLUGIN_MENUITEM_ICON}\"" |
53 | } |
54 | |
55 | autostart_plugin() |
56 | { |
57 | echo "PLUGIN_AUTOSTART=\"${PLUGIN_AUTOSTART}\"" |
58 | } |
59 | |
60 | uninstall_plugin() |
61 | { |
62 | local i |
63 | for i in ${PLUGIN_PACKAGES} |
64 | do |
65 | if [[ -n $(magequery -n ${i}) ]] |
66 | then |
67 | MAGE_BOOTSTRAP=true mage uninstall ${i} |
68 | mage clean |
69 | fi |
70 | done |
71 | |
72 | mage clean |
73 | } |
74 | |
75 | case $1 in |
76 | install) install_plugin ;; |
77 | setup) setup_plugin ;; |
78 | menuitem) create_menuitem ;; |
79 | uninstall) uninstall_plugin ;; |
80 | autostart) autostart_plugin ;; |
81 | *) echo "PLUGIN '${PLUGIN_NAME}': unkown operation '$1'" ;; |
82 | esac |