1 |
# this script gets included by config_sessions |
# this script gets called by config_sessions |
2 |
|
|
3 |
PLUGIN_NAME="remserial" |
PLUGIN_NAME="remserial" |
4 |
# all empty - do not create any menuitems |
# all empty - do not create any menuitems |
10 |
|
|
11 |
PLUGIN_AUTOSTART=0 |
PLUGIN_AUTOSTART=0 |
12 |
|
|
13 |
|
# include alx functions |
14 |
|
source /etc/alxconfig-ng/config.rc |
15 |
|
source /etc/alxconfig-ng/serial |
16 |
|
source ${ALX_FUNCTIONS}/common |
17 |
|
source ${ALX_FUNCTIONS}/mysqlfunctions |
18 |
|
# missing colors |
19 |
|
COLRED="\033[1;6m\033[31m" |
20 |
|
COLDEFAULT="\033[0m" |
21 |
|
|
22 |
|
die() |
23 |
|
{ |
24 |
|
echo "Error: $@" |
25 |
|
echo -e "${COLRED}Plugin \"${PLUGIN_NAME}\" will be disabled.${COLDEFAULT}" |
26 |
|
# disable the service |
27 |
|
rc-config del remserial > /dev/null |
28 |
|
exit 1 |
29 |
|
} |
30 |
|
|
31 |
install_plugin() |
install_plugin() |
32 |
{ |
{ |
33 |
if [[ -z $(magequery -n remserial) ]] |
if [[ -z $(magequery -n remserial) ]] |
39 |
|
|
40 |
setup_plugin() |
setup_plugin() |
41 |
{ |
{ |
42 |
|
local CONFIG |
43 |
|
|
44 |
|
# first of all get the vars |
45 |
|
evaluate_table plugin_remserial |
46 |
|
|
47 |
|
# sanitize variables |
48 |
|
[[ -z ${plugin_remserial_remote_host} ]] && die "remote_host variable is empty" |
49 |
|
[[ -z ${plugin_remserial_remote_port} ]] && die "remote_port variable is empty" |
50 |
|
[[ -z ${plugin_remserial_stty_opts} ]] && die "stty_opts variable is empty" |
51 |
|
[[ -z ${plugin_remserial_device} ]] && die "device variable is empty" |
52 |
|
# thats ok |
53 |
|
[[ -z ${plugin_remserial_extra_opts} ]] && plugin_remserial_extra_opts="" |
54 |
|
|
55 |
# setup config |
# setup config |
56 |
[[ ! -d /etc/conf.d ]] && install /etc/conf.d |
[[ ! -d /etc/conf.d ]] && install /etc/conf.d |
57 |
:> /etc/conf.d/remserial |
CONFIG="/etc/conf.d/remserial" |
58 |
echo 'REMOTE_HOST="128.20.1.52"' >> /etc/conf.d/remserial |
clearconfig |
59 |
echo 'REMOTE_PORT="3302"' >> /etc/conf.d/remserial |
addconfig "REMOTE_HOST=\"${plugin_remserial_remote_host}\"" |
60 |
echo 'STTY_OPTS="9600 raw"' >> /etc/conf.d/remserial |
addconfig "REMOTE_PORT=\"${plugin_remserial_remote_port}\"" |
61 |
echo 'DEVICE="/dev/ttyS0"' >> /etc/conf.d/remserial |
addconfig "STTY_OPTS=\"${plugin_remserial_stty_opts}\"" |
62 |
echo 'EXTRA_OPTS="-x0"' >> /etc/conf.d/remserial |
addconfig "DEVICE=\"${plugin_remserial_device}\"" |
63 |
|
addconfig "EXTRA_OPTS=\"${plugin_remserial_extra_opts}\"" |
64 |
|
|
65 |
# add to runlevels |
# add to runlevels |
66 |
rc-config add remserial |
rc-config add remserial > /dev/null |
67 |
} |
} |
68 |
|
|
69 |
# create desktop buttons |
# create desktop buttons |