Contents of /alx-src/branches/alxconf-060/plugins/remserial/plugin.sh
Parent Directory | Revision Log
Revision 3504 -
(show annotations)
(download)
(as text)
Thu Apr 19 13:27:58 2012 UTC (12 years ago) by niro
File MIME type: application/x-sh
File size: 1838 byte(s)
Thu Apr 19 13:27:58 2012 UTC (12 years ago) by niro
File MIME type: application/x-sh
File size: 1838 byte(s)
-export PLUGIN_MENUITEM_NAME in autostart function which is used as name for the generated sh script
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 | PLUGIN_AUTOSTART=0 |
12 | |
13 | install_plugin() |
14 | { |
15 | if [[ -z $(magequery -n remserial) ]] |
16 | then |
17 | MAGE_BOOTSTRAP=true mage install remserial |
18 | mage clean |
19 | fi |
20 | } |
21 | |
22 | setup_plugin() |
23 | { |
24 | # setup config |
25 | [[ ! -d /etc/conf.d ]] && install /etc/conf.d |
26 | :> /etc/conf.d/remserial |
27 | echo 'REMOTE_HOST="128.20.1.52"' >> /etc/conf.d/remserial |
28 | echo 'REMOTE_PORT="3302"' >> /etc/conf.d/remserial |
29 | echo 'STTY_OPTS="9600 raw"' >> /etc/conf.d/remserial |
30 | echo 'DEVICE="/dev/ttyS0"' >> /etc/conf.d/remserial |
31 | echo 'EXTRA_OPTS="-x0"' >> /etc/conf.d/remserial |
32 | |
33 | # add to runlevels |
34 | rc-config add remserial |
35 | } |
36 | |
37 | # create desktop buttons |
38 | create_menuitem() |
39 | { |
40 | # don't touch these echo, define variables above |
41 | echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\"" |
42 | echo "PLUGIN_MENUITEM_EXEC=\"${PLUGIN_MENUITEM_EXEC}\"" |
43 | echo "PLUGIN_MENUITEM_PARAM=\"${PLUGIN_MENUITEM_PARAM}\"" |
44 | echo "PLUGIN_MENUITEM_WORKDIR=\"${PLUGIN_MENUITEM_WORKDIR}\"" |
45 | echo "PLUGIN_MENUITEM_ICON=\"${PLUGIN_MENUITEM_ICON}\"" |
46 | } |
47 | |
48 | autostart_plugin() |
49 | { |
50 | echo "PLUGIN_AUTOSTART=\"${PLUGIN_AUTOSTART}\"" |
51 | echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\"" |
52 | } |
53 | |
54 | uninstall_plugin() |
55 | { |
56 | # remove from runlevels |
57 | rc-config del remserial |
58 | |
59 | if [[ -n $(magequery -n remserial) ]] |
60 | then |
61 | MAGE_BOOTSTRAP=true mage uninstall remserial |
62 | mage clean |
63 | fi |
64 | |
65 | # remove config files |
66 | if [[ -f /etc/conf.d/remserial ]] |
67 | then |
68 | rm -f /etc/conf.d/remserial |
69 | fi |
70 | } |
71 | |
72 | case $1 in |
73 | install) install_plugin ;; |
74 | setup) setup_plugin ;; |
75 | menuitem) create_menuitem ;; |
76 | uninstall) uninstall_plugin ;; |
77 | autostart) autostart_plugin ;; |
78 | *) echo "PLUGIN '${PLUGIN_NAME}': unkown operation '$1'" ;; |
79 | esac |