unbound: replace obsolete test expressions

Expressions '-o', '-a', and '\( \)' within test or '[ ]' are obsolete.
POSIX allows few arguments to test, so long expressions are not
portable. '[ p -a q ]' can be replaced with '[ p ] && [ q ]' instead.

Signed-off-by: Eric Luehrsen <ericluehrsen@gmail.com>
This commit is contained in:
Eric Luehrsen
2019-05-13 22:54:07 -04:00
committed by Yousong Zhou
parent 85bc7bc4f3
commit f1d1530f48
6 changed files with 49 additions and 50 deletions
+9 -8
View File
@@ -75,13 +75,13 @@ create_host_record() {
config_get name "$cfg" name
if [ -n "$name" -a -n "$ip" ] ; then
if [ -n "$name" ] && [ -n "$ip" ] ; then
create_local_zone "$name"
case $ip in
fe[89ab][0-9a-f]:*|169.254.*)
debug_ip="$ip@$host"
debug_ip="$ip@$name"
;;
[1-9a-f]*:*[0-9a-f])
@@ -109,7 +109,7 @@ create_mx_record() {
config_get pref "$cfg" pref 10
if [ -n "$domain" -a -n "$relay" ] ; then
if [ -n "$domain" ] && [ -n "$relay" ] ; then
create_local_zone "$domain"
record="$domain.@@300@@IN@@MX@@$pref@@$relay."
DM_LIST_LOCAL_DATA="$DM_LIST_LOCAL_DATA $record"
@@ -130,7 +130,7 @@ create_srv_record() {
config_get weight "$cfg" weight 10
if [ -n "$srv" -a -n "$target" -a -n "$port" ] ; then
if [ -n "$srv" ] && [ -n "$target" ] && [ -n "$port" ] ; then
create_local_zone "$srv"
record="$srv.@@300@@IN@@SRV@@$class@@$weight@@$port@@$target."
DM_LIST_LOCAL_DATA="$DM_LIST_LOCAL_DATA $record"
@@ -148,7 +148,7 @@ create_cname_record() {
config_get target "$cfg" target
if [ -n "$cname" -a -n "$target" ] ; then
if [ -n "$cname" ] && [ -n "$target" ] ; then
create_local_zone "$cname"
record="$cname.@@300@@IN@@CNAME@@$target."
DM_LIST_LOCAL_DATA="$DM_LIST_LOCAL_DATA $record"
@@ -172,7 +172,8 @@ dnsmasq_local_zone() {
fi
if [ -n "$fwd_domain" -a -n "$fwd_port" -a ! "${fwd_port:-53}" -eq 53 ] ; then
if [ -n "$fwd_domain" ] && [ -n "$fwd_port" ] \
&& [ ! "${fwd_port:-53}" -eq 53 ] ; then
# dnsmasq localhost listening ports (possible multiple instances)
DM_LIST_FWD_PORTS="$DM_LIST_FWD_PORTS $fwd_port"
DM_LIST_FWD_ZONES="$DM_LIST_FWD_ZONES $fwd_domain"
@@ -193,7 +194,7 @@ dnsmasq_local_arpa() {
fi
if [ -n "$UB_LIST_NETW_WAN" -a "$DM_D_WAN_FQDN" -gt 0 ] ; then
if [ -n "$UB_LIST_NETW_WAN" ] && [ "$DM_D_WAN_FQDN" -gt 0 ] ; then
for ifsubnet in $UB_LIST_NETW_WAN ; do
ifarpa=$( domain_ptr_any "${ifsubnet#*@}" )
DM_LIST_FWD_ZONES="$DM_LIST_FWD_ZONES $ifarpa"
@@ -260,7 +261,7 @@ dnsmasq_active() {
dnsmasq_local_arpa
if [ -n "$DM_LIST_FWD_PORTS" -a -n "$DM_LIST_FWD_ZONES" ] ; then
if [ -n "$DM_LIST_FWD_PORTS" ] && [ -n "$DM_LIST_FWD_ZONES" ] ; then
{
# Forward to dnsmasq on same host for DHCP lease hosts
echo "# $UB_SRVMASQ_CONF generated by UCI $( date -Is )"