commit:     04e6565b185fd3066822333e1b1932284ec1f6b7
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 15 19:53:27 2020 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Jan  5 12:44:05 2021 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=04e6565b

net/dhcpcd.sh: Remove support for ancient dhcpcd versions

Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 net/dhcpcd.sh | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/net/dhcpcd.sh b/net/dhcpcd.sh
index 548a503..e3410d8 100644
--- a/net/dhcpcd.sh
+++ b/net/dhcpcd.sh
@@ -20,7 +20,7 @@ dhcpcd_start()
        # alter the pidfile's name (#718114)
        # Save the args into a file so dhcpcd_stop can later re-use the very
        # same args later.
-       local args= opt= pidfile= opts= new=true 
argsfile=/run/netifrc_dhcpcd_${IFACE}_args
+       local args= opt= pidfile= opts= 
argsfile=/run/netifrc_dhcpcd_${IFACE}_args
        eval args=\$dhcpcd_${IFVAR}
        [ -z "${args}" ] && args=${dhcpcd}
        echo "${args}" > ${argsfile}
@@ -30,33 +30,24 @@ dhcpcd_start()
        eval opts=\$dhcp_${IFVAR}
        [ -z "${opts}" ] && opts=${dhcp}
 
-       case "$(dhcpcd --version)" in
-               "dhcpcd "[123]*) new=false;;
+       case "$(dhcpcd --version | head -n 1)" in
+               "dhcpcd "[123]*)
+                       eerror 'The dhcpcd version is too old. Please upgrade.'
+                       return 1
+                       ;;
        esac
 
        # Map some generic options to dhcpcd
        for opt in ${opts}; do
                case "${opt}" in
                        nodns)
-                               if ${new}; then
-                                       args="${args} -C resolv.conf"
-                               else
-                                       args="${args} -R"
-                               fi
+                               args="${args} -C resolv.conf"
                                ;;
                        nontp)
-                               if ${new}; then
-                                       args="${args} -C ntp.conf"
-                               else
-                                       args="${args} -N"
-                               fi
+                               args="${args} -C ntp.conf"
                                ;;
                        nonis)
-                               if ${new}; then
-                                       args="${args} -C yp.conf"
-                               else
-                                       args="${args} -Y"
-                               fi
+                               args="${args} -C yp.conf"
                                ;;
                        nogateway) args="${args} -G";;
                        nosendhost) args="${args} -h ''";

Reply via email to