Contents of /alx-src/branches/alxconf-060/plugins/remserial/plugin.sh
Parent Directory | Revision Log
Revision 2749 -
(show annotations)
(download)
(as text)
Thu Aug 11 19:51:21 2011 UTC (12 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1613 byte(s)
Thu Aug 11 19:51:21 2011 UTC (12 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1613 byte(s)
-added rudimentary plugin support
1 | # this script gets included by config_sessions |
2 | |
3 | PLUGIN_NAME="remserial" |
4 | # all empty - do not create any menuitems |
5 | PLUGIN_MENUITEM_NAME="" |
6 | PLUGIN_MENUITEM_EXEC="" |
7 | PLUGIN_MENUITEM_PARAM="" |
8 | PLUGIN_MENUITEM_WORKDIR="" |
9 | PLUGIN_MENUITEM_ICON="" |
10 | |
11 | install_plugin() |
12 | { |
13 | if [[ -z $(magequery -n remserial) ]] |
14 | then |
15 | MAGE_BOOTSTRAP=true mage install remserial |
16 | mage clean |
17 | fi |
18 | |
19 | # setup config |
20 | [[ ! -d /etc/conf.d ]] && install /etc/conf.d |
21 | :> /etc/conf.d/remserial |
22 | echo 'REMOTE_HOST="128.20.1.52"' >> /etc/conf.d/remserial |
23 | echo 'REMOTE_PORT="3302"' >> /etc/conf.d/remserial |
24 | echo 'STTY_OPTS="9600 raw"' >> /etc/conf.d/remserial |
25 | echo 'DEVICE="/dev/ttyS0"' >> /etc/conf.d/remserial |
26 | echo 'EXTRA_OPTS="-x0"' >> /etc/conf.d/remserial |
27 | |
28 | # add to runlevels |
29 | rc-config add remserial |
30 | } |
31 | |
32 | # create desktop buttons |
33 | create_menuitem() |
34 | { |
35 | # don't touch these echo, define variables above |
36 | echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\"" |
37 | echo "PLUGIN_MENUITEM_EXEC=\"${PLUGIN_MENUITEM_EXEC}\"" |
38 | echo "PLUGIN_MENUITEM_PARAM=\"${PLUGIN_MENUITEM_PARAM}\"" |
39 | echo "PLUGIN_MENUITEM_WORKDIR=\"${PLUGIN_MENUITEM_WORKDIR}\"" |
40 | echo "PLUGIN_MENUITEM_ICON=\"${PLUGIN_MENUITEM_ICON}\"" |
41 | } |
42 | |
43 | uninstall_plugin() |
44 | { |
45 | # remove from runlevels |
46 | rc-config del remserial |
47 | |
48 | if [[ -n $(magequery -n remserial) ]] |
49 | then |
50 | MAGE_BOOTSTRAP=true mage uninstall remserial |
51 | mage clean |
52 | fi |
53 | |
54 | # remove config files |
55 | if [[ -f /etc/conf.d/remserial ]] |
56 | then |
57 | rm -f /etc/conf.d/remserial |
58 | fi |
59 | } |
60 | |
61 | case $1 in |
62 | install) install_plugin ;; |
63 | menuitem) create_menuitem ;; |
64 | uninstall) uninstall_plugin ;; |
65 | *) echo "PLUGIN '${PLUGIN_NAME}': unkown operation '$1'" ;; |
66 | esac |