1 #!/bin/sh /etc/rc.common
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
12 facters_dir
="/etc/alfred"
18 append
"interfaces" "$1" ","
24 local disabled interface mode
27 # check if section is disabled
28 config_get_bool disabled
"$section" disabled
0
29 [ $disabled = 0 ] ||
return 1
33 config_list_foreach
"$section" "interface" append_interface
34 if [ -z "$interfaces" ]; then
35 config_get interface
"$section" interface
36 append_interface
"$interface"
38 append args
"-i $interfaces"
40 config_get mode
"$section" mode
41 [ "$mode" = "master" ] && append args
"-m"
43 config_get batmanif
"$section" batmanif
44 append args
"-b $batmanif"
46 append alfred_args
"$args"
49 config_get_bool start_vis
"$section" start_vis
0
50 if [ "$start_vis" = 1 ] && [ -x /usr
/sbin
/batadv-vis
]; then
52 append vis_args
"-i $batmanif -s"
55 config_get_bool run_facters
"$section" run_facters
0
62 config_foreach alfred_start alfred
64 [ "$enable" = "0" ] && return 0
66 procd_open_instance
"alfred"
67 procd_set_param
command /usr
/sbin
/alfred
68 procd_append_param
command ${alfred_args}
71 [ "$vis_enable" = "1" ] && {
72 procd_open_instance
"batadv-vis"
73 procd_set_param
command /usr
/sbin
/batadv-vis
74 procd_append_param
command ${vis_args}
78 [ "$run_facters" = "1" ] && {
79 ( for file in $facters_dir/* ; do [ -x $file ] && $file ; done )
80 if ! ( grep -q "for file in $facters_dir/\* ; do " /etc
/crontabs
/root
2>/dev
/null
) ; then
81 echo "*/5 * * * * ( for file in $facters_dir/* ; do [ -x \$file ] && \$file ; done )" >> /etc
/crontabs
/root
82 /etc
/init.d
/cron
enable
83 /etc
/init.d
/cron restart
89 procd_add_reload_trigger
"alfred"
93 [ -e /etc
/crontabs
/root
] && {
94 sed "\|for file in $facters_dir/\* ; do |d" -i /etc
/crontabs
/root
95 /etc
/init.d
/cron restart