Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/dhcpcd/dist/hooks PR install/53622 (probably)



details:   https://anonhg.NetBSD.org/src/rev/e5af76aaf54b
branches:  trunk
changeset: 433585:e5af76aaf54b
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Sep 22 13:17:46 2018 +0000

description:
PR install/53622  (probably)

When used as part of a network based install kernel, the SMALL "test" (aka [)
does not support -a or -o, so rewrite these scripts to avoid using that.

diffstat:

 external/bsd/dhcpcd/dist/hooks/20-resolv.conf      |  12 ++++++------
 external/bsd/dhcpcd/dist/hooks/29-lookup-hostname  |   2 +-
 external/bsd/dhcpcd/dist/hooks/30-hostname         |   8 ++++----
 external/bsd/dhcpcd/dist/hooks/50-ntp.conf         |   2 +-
 external/bsd/dhcpcd/dist/hooks/50-yp.conf          |   2 +-
 external/bsd/dhcpcd/dist/hooks/50-ypbind.in        |   2 +-
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in |  18 +++++++++---------
 7 files changed, 23 insertions(+), 23 deletions(-)

diffs (177 lines):

diff -r c86aaa9fedfe -r e5af76aaf54b external/bsd/dhcpcd/dist/hooks/20-resolv.conf
--- a/external/bsd/dhcpcd/dist/hooks/20-resolv.conf     Sat Sep 22 12:56:16 2018 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/20-resolv.conf     Sat Sep 22 13:17:46 2018 +0000
@@ -77,19 +77,19 @@
 eval_nd_dns()
 {
        eval ltime=\$nd${i}_rdnss${j}_lifetime
-       if [ -z "$ltime" -o "$ltime" = 0 ]; then
+       if [ -z "$ltime" ] || [ "$ltime" = 0 ]; then
                rdnss=
        else
                eval rdnss=\$nd${i}_rdnss${j}_servers
        fi
        eval ltime=\$nd${i}_dnssl${j}_lifetime
-       if [ -z "$ltime" -o "$ltime" = 0 ]; then
+       if [ -z "$ltime" ] || [ "$ltime" = 0 ]; then
                dnssl=
        else
                eval dnssl=\$nd${i}_dnssl${j}_search
        fi
 
-       [ -z "$rdnss" -a -z "$dnssl" ] && return 1
+       [ -z "${rdnss}${dnssl}" ] && return 1
 
        [ -n "$rdnss" ] && new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
        [ -n "$dnssl" ] && new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
@@ -130,9 +130,9 @@
        fi
 
        # If we don't have any configuration, remove it
-       if [ -z "$new_domain_name_servers" -a \
-               -z "$new_domain_name" -a \
-               -z "$new_domain_search" ]; then
+       if [ -z "$new_domain_name_servers" ] &&
+          [ -z "$new_domain_name" ] &&
+          [ -z "$new_domain_search" ]; then
                remove_resolv_conf
                return $?
        fi
diff -r c86aaa9fedfe -r e5af76aaf54b external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
--- a/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname Sat Sep 22 12:56:16 2018 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname Sat Sep 22 13:17:46 2018 +0000
@@ -29,7 +29,7 @@
 
 set_hostname()
 {
-       if [ -z "$new_host_name" -a -z "$new_fqdn_name" ]; then
+       if [ -z "${new_host_name}${new_fqdn_name}" ]; then
                export new_host_name="$(lookup_hostname)"
        fi
 }
diff -r c86aaa9fedfe -r e5af76aaf54b external/bsd/dhcpcd/dist/hooks/30-hostname
--- a/external/bsd/dhcpcd/dist/hooks/30-hostname        Sat Sep 22 12:56:16 2018 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/30-hostname        Sat Sep 22 13:17:46 2018 +0000
@@ -87,8 +87,8 @@
                fi
        elif [ -n "$old_host_name" ]; then
                if ${hfqdn}; then
-                       if [ -n "$old_domain_name" -a \
-                           "$old_host_name" = "${old_host_name#*.}" ]
+                       if [ -n "$old_domain_name" ] &&
+                          [ "$old_host_name" = "${old_host_name#*.}" ]
                        then
                                [ "$hostname" = \
                                    "$old_host_name.$old_domain_name" ]
@@ -131,8 +131,8 @@
                fi
        elif [ -n "$new_host_name" ]; then
                if ${hfqdn}; then
-                       if [ -n "$new_domain_name" -a \
-                           "$new_host_name" = "${new_host_name#*.}" ]
+                       if [ -n "$new_domain_name" ] &&
+                          [ "$new_host_name" = "${new_host_name#*.}" ]
                        then
                                try_hostname "$new_host_name.$new_domain_name"
                        else
diff -r c86aaa9fedfe -r e5af76aaf54b external/bsd/dhcpcd/dist/hooks/50-ntp.conf
--- a/external/bsd/dhcpcd/dist/hooks/50-ntp.conf        Sat Sep 22 12:56:16 2018 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/50-ntp.conf        Sat Sep 22 13:17:46 2018 +0000
@@ -96,7 +96,7 @@
                printf %s "$servers" >> "$cf"
                echo "$signature_base_end${header:+ $from }$header" >> "$cf"
        else
-               [ -e "$ntp_conf" -a -e "$cf" ] || return
+               [ -e "$ntp_conf" ] && [ -e "$cf" ] || return
        fi
 
        # If we changed anything, restart ntpd
diff -r c86aaa9fedfe -r e5af76aaf54b external/bsd/dhcpcd/dist/hooks/50-yp.conf
--- a/external/bsd/dhcpcd/dist/hooks/50-yp.conf Sat Sep 22 12:56:16 2018 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/50-yp.conf Sat Sep 22 13:17:46 2018 +0000
@@ -8,7 +8,7 @@
 
 make_yp_conf()
 {
-       [ -z "$new_nis_domain" -a -z "$new_nis_servers" ] && return 0
+       [ -z "${new_nis_domain}${new_nis_servers}" ] && return 0
        cf=/etc/yp.conf."$ifname"
        rm -f "$cf"
        echo "$signature" > "$cf"
diff -r c86aaa9fedfe -r e5af76aaf54b external/bsd/dhcpcd/dist/hooks/50-ypbind.in
--- a/external/bsd/dhcpcd/dist/hooks/50-ypbind.in       Sat Sep 22 12:56:16 2018 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/50-ypbind.in       Sat Sep 22 13:17:46 2018 +0000
@@ -41,7 +41,7 @@
        fi
 
        nd="$(best_domain)"
-       if [ $? = 0 -a "$nd" != "$(domainname)" ]; then
+       if [ $? = 0 ] && [ "$nd" != "$(domainname)" ]; then
                domainname "$nd"
                if [ -n "$ypbind_restart_cmd" ]; then
                        eval $ypbind_restart_cmd
diff -r c86aaa9fedfe -r e5af76aaf54b external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in
--- a/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in        Sat Sep 22 12:56:16 2018 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in        Sat Sep 22 13:17:46 2018 +0000
@@ -107,7 +107,7 @@
 # Compare two files.
 comp_file()
 {
-       [ -e "$1" -a -e "$2" ] || return 1
+       [ -e "$1" ] && [ -e "$2" ] || return 1
 
        if type cmp >/dev/null 2>&1; then
                cmp -s "$1" "$2"
@@ -187,11 +187,11 @@
 valid_domainname()
 {
        name="$1"
-       [ -z "$name" -o ${#name} -gt 255 ] && return 1
+       [ -z "$name" ] || [ ${#name} -gt 255 ] && return 1
        
        while [ -n "$name" ]; do
                label="${name%%.*}"
-               [ -z "$label" -o ${#label} -gt 63 ] && return 1
+               [ -z "$label" ] || [ ${#label} -gt 63 ] && return 1
                case "$label" in
                -*|_*|*-|*_)            return 1;;
                *[![:alnum:]_-]*)       return 1;;
@@ -231,16 +231,16 @@
        # systems we try to detect them first.
        status="@STATUSARG@"
        : ${status:=status}
-       if [ -x /bin/systemctl -a -S /run/systemd/private ]; then
+       if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then
                _service_exists="/bin/systemctl --quiet is-enabled \$1.service"
                _service_status="/bin/systemctl --quiet is-active \$1.service"
                _service_cmd="/bin/systemctl \$2 \$1.service"
-       elif [ -x /usr/bin/systemctl -a -S /run/systemd/private ]; then
+       elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then
                _service_exists="/usr/bin/systemctl --quiet is-enabled \$1.service"
                _service_status="/usr/bin/systemctl --quiet is-active \$1.service"
                _service_cmd="/usr/bin/systemctl \$2 \$1.service"
-       elif [ -x /sbin/rc-service -a \
-           -s /libexec/rc/init.d/softlevel -o -s /run/openrc/softlevel ]
+       elif [ -x /sbin/rc-service ] && [ -s /libexec/rc/init.d/softlevel ] ||
+            [ -s /run/openrc/softlevel ]
        then
                _service_exists="/sbin/rc-service -e \$1"
                _service_cmd="/sbin/rc-service \$1 -- -D \$2"
@@ -259,7 +259,7 @@
        elif [ -x /usr/bin/sv ]; then
                _service_exists="/usr/bin/sv status \$1 >/dev/null 2>&1"
                _service_cmd="/usr/bin/sv \$2 \$1"
-       elif [ -e /etc/slackware-version -a -d /etc/rc.d ]; then
+       elif [ -e /etc/slackware-version ] && [ -d /etc/rc.d ]; then
                _service_exists="[ -x /etc/rc.d/rc.\$1 ]"
                _service_cmd="/etc/rc.d/rc.\$1 \$2"
                _service_status="/etc/rc.d/rc.\$1 status >/dev/null 2>&1"
@@ -274,7 +274,7 @@
                done
                if [ -e /etc/arch-release ]; then
                        _service_status="[ -e /var/run/daemons/\$1 ]"
-               elif [ "$x" = "/etc/rc.d" -a -e /etc/rc.d/rc.subr ]; then
+               elif [ "$x" = "/etc/rc.d" ] && [ -e /etc/rc.d/rc.subr ]; then
                        _service_status="$x/\$1 check >/dev/null 2>&1"
                fi
        fi



Home | Main Index | Thread Index | Old Index