'
log() {
- logger -t olsrd -p daemon.info -s "${initscript}: $@"
+ logger -t olsrd -p daemon.info -s "${initscript}: $*"
}
error() {
- logger -t olsrd -p daemon.err -s "${initscript}: ERROR: $@"
+ logger -t olsrd -p daemon.err -s "${initscript}: ERROR: $*"
}
warn() {
- logger -t olsrd -p daemon.warn -s "${initscript}: WARNING: $@"
+ logger -t olsrd -p daemon.warn -s "${initscript}: WARNING: $*"
}
validate_varname() {
fi
fi
- echo -n "${N}$param$option $value"
-
- return 0
+ printf '%s' "${N}$param$option $value"
}
olsrd_write_plparam() {
local funcname="olsrd_write_plparam"
local param="$1"
local cfg="$2"
- validate_varname "$cfg" || return 1
local option="$3"
- validate_varname "$option" || return 1
local value="$4"
local option_type="$5"
local _option oldIFS
+ validate_varname "$cfg" || return 1
+ validate_varname "$option" || return 1
+
if [ "$option_type" = bool ]; then
case "$value" in
1|on|true|enabled|yes) value=yes;;
[ -z "$ifname" ] || value=$ifname
fi
- echo -n "${N}${param}PlParam \"$option\" \"$value\""
-
- return 0
+ printf '%s' "${N}${param}PlParam \"$option\" \"$value\""
}
config_update_schema() {
already_in_schema "speed" && {
get_value_for_entry "speed"
- if [ 2>/dev/null $value -gt 0 -a $value -le 20 ]; then
+ if test 2>/dev/null "$value" -gt 0 -a "$value" -le 20 ; then
speed="$value"
else
log "$funcname() Warning: invalid speed-value: '$value' - allowed integers: 1...20, fallback to 6"
if [ -n "$speed" ]; then # like sven-ola freifunk firmware fff-1.7.4
case "$schema_entry" in
HelloInterval)
- value="$(( $speed / 2 + 1 )).0"
+ value="$(( speed / 2 + 1 )).0"
;;
HelloValidityTime)
- value="$(( $speed * 25 )).0"
+ value="$(( speed * 25 )).0"
;;
- TcInterval) # todo: not fisheye? -> $(( $speed * 2 ))
- value=$(( $speed / 2 ))
+ TcInterval) # todo: not fisheye? -> $(( speed * 2 ))
+ value=$(( speed / 2 ))
[ $value -eq 0 ] && value=1
value="$value.0"
;;
TcValidityTime)
- value="$(( $speed * 100 )).0"
+ value="$(( speed * 100 )).0"
;;
MidInterval)
- value="$(( $speed * 5 )).0"
+ value="$(( speed * 5 )).0"
;;
MidValidityTime)
- value="$(( $speed * 100 )).0"
+ value="$(( speed * 100 )).0"
;;
HnaInterval)
- value="$(( $speed * 2 )).0"
+ value="$(( speed * 2 )).0"
;;
HnaValidityTime)
- value="$(( $speed * 25 )).0"
+ value="$(( speed * 25 )).0"
;;
*)
get_value_for_entry "$schema_entry" || continue
[ "$IPCCONNECT_COUNT" -gt 0 ] && return 0
- echo -n "${N}IpcConnect${N}{"
+ printf '%s' "${N}IpcConnect${N}{"
config_write_options "$OLSRD_IPCCONNECT_SCHEMA" "$cfg" olsrd_write_option "${T}"
echo "${N}}"
IPCCONNECT_COUNT=$((IPCCONNECT_COUNT + 1))
-
- return 0
}
olsrd_write_hna4() {
return 0
fi
- [ "$HNA4_COUNT" -le 0 ] && echo -n "${N}Hna4${N}{"
- echo -n "${N}${T}${T}$netaddr $netmask"
+ [ "$HNA4_COUNT" -le 0 ] && printf '%s' "${N}Hna4${N}{"
+ printf '%s' "${N}${T}${T}$netaddr $netmask"
HNA4_COUNT=$((HNA4_COUNT + 1))
-
- return 0
}
olsrd_write_hna6() {
return 0
fi
- [ "$HNA6_COUNT" -le 0 ] && echo -n "${N}Hna6${N}{"
- echo -n "${N}${T}${T}$netaddr $prefix"
+ [ "$HNA6_COUNT" -le 0 ] && printf '%s' "${N}Hna6${N}{"
+ printf '%s' "${N}${T}${T}$netaddr $prefix"
HNA6_COUNT=$((HNA6_COUNT + 1))
-
- return 0
}
find_most_recent_plugin_libary()
;;
esac
- echo -n "${N}LoadPlugin \"$library\"${N}{"
+ printf '%s' "${N}LoadPlugin \"$library\"${N}{"
config_write_options "$OLSRD_LOADPLUGIN_SCHEMA" "$cfg" olsrd_write_plparam "${T}"
echo "${N}}"
}
[ -z "$ifnames" ] && return 0
- echo -n "${N}Interface$ifnames${N}{"
+ printf '%s' "${N}Interface$ifnames${N}{"
config_write_options "$OLSRD_INTERFACE_SCHEMA" "$cfg" olsrd_write_option "${T}"
echo "${N}}"
INTERFACES_COUNT=$((INTERFACES_COUNT + 1))
-
- return 0
}
olsrd_write_interface_defaults() {
local cfg="$1"
validate_varname "$cfg" || return 0
- echo -n "${N}InterfaceDefaults$ifnames${N}{"
+ printf '%s' "${N}InterfaceDefaults$ifnames${N}{"
config_write_options "$OLSRD_INTERFACE_DEFAULTS_SCHEMA" "$cfg" olsrd_write_option "${T}"
echo "${N}}"