Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3503 - (hide annotations) (download) (as text)
Thu Apr 19 12:17:20 2012 UTC (12 years ago) by niro
File MIME type: application/x-sh
File size: 1781 byte(s)
-added autostart support for plugins
1 niro 2749 # 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 niro 3503 PLUGIN_AUTOSTART=0
12    
13 niro 2749 install_plugin()
14     {
15     if [[ -z $(magequery -n remserial) ]]
16     then
17     MAGE_BOOTSTRAP=true mage install remserial
18     mage clean
19     fi
20 niro 2779 }
21 niro 2749
22 niro 2779 setup_plugin()
23     {
24 niro 2749 # 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 niro 3503 autostart_plugin()
49     {
50     echo "PLUGIN_AUTOSTART=\"${PLUGIN_AUTOSTART}\""
51     }
52    
53 niro 2749 uninstall_plugin()
54     {
55     # remove from runlevels
56     rc-config del remserial
57    
58     if [[ -n $(magequery -n remserial) ]]
59     then
60     MAGE_BOOTSTRAP=true mage uninstall remserial
61     mage clean
62     fi
63    
64     # remove config files
65     if [[ -f /etc/conf.d/remserial ]]
66     then
67     rm -f /etc/conf.d/remserial
68     fi
69     }
70    
71     case $1 in
72     install) install_plugin ;;
73 niro 2779 setup) setup_plugin ;;
74 niro 2749 menuitem) create_menuitem ;;
75     uninstall) uninstall_plugin ;;
76 niro 3503 autostart) autostart_plugin ;;
77 niro 2749 *) echo "PLUGIN '${PLUGIN_NAME}': unkown operation '$1'" ;;
78     esac